Jump to content
xisto Community
Sign in to follow this  
outwarsecrets

Embeding Pages

Recommended Posts

Is there a way to have php act as an iframe? I dont want to have to change every single page when i want to move something around. If anyone can give me a tutorial or somethign telling me how that would be great, or ven another way of doing this without frames.

Share this post


Link to post
Share on other sites

Taken Directly from http://lissaexplains.com/ (The ads there are so horrible.)

 

How do I make server side includes (SSI)?    The most practical use of server side includes is to edit a large amount of pages just by editing one file. If you have a large site, using server side includes can make it a breeze to update your pages. As you may have noticed, my pages all have the .shtml extension instead of the regular .html extension. This is because I use SSI on my site to make it easier to update. I use it for the left navigation menu, my header, and my footer. My navigation menu is actually a text file that I upload to my server. A small code included in my .shtml document calls the text file when needed to make it appear on my site. I can update every page that has a menu just by updating that one .txt file and uploading it to my server. Since I have 50 + pages, it makes it so much easier to update. Keep in mind that not all servers allow the use of SSI, and you will probably have to rename all of your regular .html documents to .shtml (some servers allow you to continue to use the .html extension, but not many of them do).

 

First, rename your regular .html documents to .shtml.

 

Next, make a text file (you can use Notepad). You can name the text file with the extension .txt, .html, or .shtml, it depends on what you want. The text file can include HTML, javascript, music, whatever you want to show up on a large number of pages. After you've made the text file, save it with the .txt file extension, name it anything you want.

 

Insert this code in your .shtml document, changing the info in bold to reflect your filename:

 

<!--#include file="yourfilename.txt" -->

 

Now, when someone accesses your site, the text file will be inserted into your document and show up as regular html.

 

It's really not very hard, and it's an awesome tool if you have a large site!


Original Page can be found here.

 

:P Enjoy SSI.

 

Edit: I forgot to mention, I believe php will work as long as you have the tags. I may be wrong, however.

Share this post


Link to post
Share on other sites

PHP is a server-side language only. What it returns to the user is HTML - not PHP. So no, you cannot use PHP within an iframe, as PHP cannot be called from within HTML (HTML, however, can be imbedded in PHP).

You could easily create a frame from within PHP. For example:

<?php[/br]echo "<iframe src=\"page.html\">";?>

Or you could set the frame's source to be a PHP script ('src="script.php"').

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
Sign in to follow this  

×
×
  • 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.