PHP require() problem

    Date: 02/12/06 (WebDesign)    Keywords: php, templates, html, apache

    I've decided to finally start learning PHP. I've been doing rather well, until I decided to chop up my template structure a bit more.

    Originally I had my directory structure like so:

    HTTPDEV
    ..bin
    ....js
    ..Data
    ..Templates
    ....footers
    ....headers
    ....mains
    ....navs
    ....images
    ....styles
    ....miscs

    I have my main page (proj1.php) in the HTTPDEV folder, with all of the other files down the hierarchy.

    I've added a bodies folder beneath Templates, and to put the code to include items from footers, headers, mains, navs, miscs, etc in it.

    This is the code in proj1.php under the bodies directory:

    ?php
    				echo "div id=\"header\">";
    
    				require('../headers/proj1.html');
    
    				echo"/div>";
    				echo"div id=\"container\">";
    				echo"div id=\"center\" class=\"column\">";
    				
    				require('../mains/proj1.html');
    
    				echo"";
    				echo"div id=\"left\" class=\"column\">";
    
    				require('../navs/proj1.html');
    
    				echo"/div>";
    				echo"div id=\"right\" class=\"column\">";
    				
    				require('../miscs/proj1.html');
    
    				echo"/div>";
    				echo"/div>";
    				echo"div id=\"footer\">";
    
    				require('../footers/proj1.html');
    
    				echo"/div>";
    ?
    

    But this gives me this error:

    Warning: main(../headers/proj1.html) [function.main]: failed to open stream: No such file or directory in J:\DevProj\HTTPDEV\Templates\bodies\proj1.php on line 4

    Fatal error: main() [function.require]: Failed opening required '../headers/proj1.html' (include_path='C:\Program Files\Apache Group\Apache2\modules\php\PEAR') in J:\DevProj\HTTPDEV\Templates\bodies\proj1.php on line 4


    My directory structure should be putting things where they belong... All I did was move the requires into another file to aid in modularity. It worked before when the requires were all require('Templates/......

    Source: http://community.livejournal.com/webdesign/1058584.html

« slow server issue? || CYW »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home