Re: A question that has been bugging me..
| From: | brian | Date: | Thu, 16 Aug 2007 17:02:04 +0000 |
| Subject: | Re: A question that has been bugging me.. | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-260934@lists.php.net to get a copy of this message | ||
Jason Pruim wrote:
On Aug 16, 2007, at 11:56 AM, Daniel Brown wrote:One thing to be aware of is that PHP's include() needs the full directory path whereas the SSI parser takes it from docroot (if using "virtual"). So, if you had something like this in your shtml file: <!--#include virtual="/includes/interface/top.html" --> <title>foo</title> </head> <body> <div id="wrapper"> <!--#include virtual="/includes/interface/banner.html" --> <!--#include virtual="/includes/interface/nav.php" --> <div id="content"> you can change it husly for a PHP script: <?php // some PHP stuff here, perhaps include "${_SERVER['DOCUMENT_ROOT']}/includes/interface/top.html"; // note the double-quotes above ?> <title>foo</title> </head> <body> <div id="wrapper"> <?php include "${_SERVER['DOCUMENT_ROOT']}/includes/interface/banner.html"; include "${_SERVER['DOCUMENT_ROOT']}/includes/interface/nav.php"; ?> <div id="content"> (where top.html contains CSS links, script tags, etc.) So, in order to create any of your PHP pages, you can simply copy one of the SHTML files and make those simple changes to the include calls. brianBecause I came as a HTML person into PHP and didn't even think about being able to include my headers, footers, nav etc in the php file... Just include the php in the html... I'll look into that later today if I have time :)Otherwise, is there any reason you're not just doing somethinglike the following? <?include('templates/header.html'); // Data goes here include('templates/footer.html');?>