Jump to content
xisto Community
Joshthegreat

<? Include ?> <iframe/> This could save me tons of time

Recommended Posts

yes hacking is an issue and I also have used code to check for slashes, etc.

 

I made a webpage using similar method.  BAsically one template file which loads content a conent file.  I find that this is not the best way to layout a site.  I find it is better to include the layout from a file rather than the content.

 

basically like this

 

include banner.html;

include navigation.html;

<content code here>

include footer.html;

 

I think this method is actually better because each page is easier to customize.

70244[/snapback]


Yes, I make my pages just like you.

<?

include("top.html");

include("content.html");

include("bottom.html");

?>

 

I don't know what would I do without php... When the site is updated, I would have to change every page, everything, many times.... :T

Share this post


Link to post
Share on other sites

yup, because of PHP it is so easy to change layouts. I can just make changes in one place and my whole site is updated. It is very convenient. I used to use PERL but I find PHP is easier to program cause it is so similar to C. I also make my own image galleries in PHP. Like 10 or so lines of code will be able to do UNLIMITED image galleries. It is amazing.

Share this post


Link to post
Share on other sites

Well, I don't really know anything about php, and I can't get it to work :)

Here's the code I tried

<body><p align="center"><img border="0" src="logo.gif" width="500" height="100"></p><table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">  <tr>    <td width="13%">MENU<p>link1<br>    link2<br>    link3<br>    link4</td>    <td width="87%" valign="top"><?php include($load); ?></td>  </tr></table></body>
Well, easy, easy code, but I know I have forgot something. what?
In the same folder, I have "contentpage.html". Trying to load index.php?load=contentpage.html don't work.
Hehe as I said, I don't know anything about php, just trying it now :)

Share this post


Link to post
Share on other sites

Well, easy, easy code, but I know I have forgot something. what?

In the same folder, I have "contentpage.html". Trying to load index.php?load=contentpage.html don't work.

Hehe as I said, I don't know anything about php, just trying it now :)

70472[/snapback]


the code looks right to me. what is your website and what is the problem? any error messages? is your file named index.php? are there other index files in the same directory? delete index.htm or index.html because they will get loaded before index.php (or you can rename them). Post your site so it will be easier to diagnose the problem.

Share this post


Link to post
Share on other sites

Still can't get it to work. I am using <?php include 'file.htm'; ?> and it works fine, but <?php include($load); ?> won't work, when I enter loadpage.php?load=testpage.htm (that's what I called it). Do it really have to be INDEX.php or is LOADPAGE.php allowed too? Where the testpage.htm should load, there's nothing...

Share this post


Link to post
Share on other sites

I suggest you try using XMLHttpRequest to make your website unique, as well as making your website load faster, and consumes less bandwidth. The include function in PHP is really useful, but when I comes to uploading your whole website, having seperate files can be a little pain, so if you can, use only 1 PHP file for all of your pages. Or use MySQL to fetch each pages. :)

Share this post


Link to post
Share on other sites

Or you can trying integrating all the codes into the files you want to open then lesser error will open... Using the includ codes is very dangerous and may result to pages breakdown...

Share this post


Link to post
Share on other sites

What I want, is just to get <?php include($load); ?> to work, since I think it's more usefull than <?php include 'file.htm'; ?>, and there will be less files, but for some reasons I can't get it to work!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.