Re: Adding includes to files

From: Date: Thu, 22 Apr 2004 15:45:41 +0000
Subject: Re: Adding includes to files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184257@lists.php.net to get a copy of this message
You could either include the files without assigning the contents to a variable - but that would display those right away: <?php include('nav/top_nav.html'); ?> or you could read the contents of the file like: <?php $display_block .= is_readable('nav/top_nav.html') ? file_get_contents('nav/top_nav.html') : ''; ?> Richard Thursday, April 22, 2004, 5:12:21 PM, thus was written: > I need to add PHP calls to include a file to each page as it is > generated, the only thing is I can't get the includes to come through > correctly: > <! Code> > $display_block .= "<?php include(\"nav/top_nav.html\"); ?>"; > $display_block .= "<?php include(\"nav/side_nav.html\"); ?>"; > <! End Code> > At the end of the generation I write $display_block to a file as > $display_block holds all the data it accumulates through the run. How > do I rewrite the inlclude to work, or do I need to find another way to > make the includes? The includes are all template files that I used on > the site to keep everything consistent. > Thanks, > Robert

« previous php.general (#184257) next »