PHP includes run (on the server) when the page is requested. A single
php file may include as many other files (php or not) as it requests.
A little sidebar: Each included file is added to the page source as
raw text; in the case of PHP files, this happens before the composite
script is evaluated for code, so what is added will be evaluated in
one pass along with the base code in the page. If you want the
result of the included page to be added (you want it to be
rendered as code, then added as final HTML to your output stream) then
you need to create a function to do that.
Anyway, iframes have one useful feature that PHP includes do not: they
can handle a complete page being added to another complete page
without generating an invalid mess. But if you were to use a PHP
include as a straight drop-in replacement for an iframe, you would end
up with a page-within-a-page, or the aforementioned mess.
If you want to include a page in another page using PHP, you either
have to strip off its HTML, HEAD and BODY tags, and include only the
content of the BODY tag (there’s an Action for that, called PHP Make
Insert Page) or you have to live with the fact that your composite
page will be really broken and probably won’t display at all in some
browsers.
Long story short: Change your page filename to end in .php rather
than .html. Page / Insert / Markup Item. In the resulting dialog box,
add <?php include_once('path/to/include/file.php'); ?>
or (big IF
here) if your server has enabled protocol handlers for files: <?php include_once('http://url.of.your.site/page.html'); ?>
Okay the
dialog, then look on your page for a 100px square box with a [H] in
the corner. Resize and position this box to your liking. The remote
file will appear there when the page is loaded through a real Web
server (not locally using any form of preview). But again, you really
must make sure that what you are loading is a fragment of a page, not
an entire stand-alone page. For that, you really should stick to the
iframe.
Walter
On Feb 24, 2009, at 9:05 AM, Ian Halstead wrote:
I’m constructing a page that will contain links that then load
content into a single positional area on that page.
I could use an iframe set-up, and this does indeed work, however, is
there a simple alternative method that I can use that employs php?
I get the idea behind ‘php includes’, but am stuck as to how to get
the links to load the required content into a designated layer. Any
help will be highly appreciated.
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options