Jump to content

Including a standard file in all directories


Guardian-Mage

Recommended Posts

I have one layout page that all directories use on my website. How can I make it so that no matter where the file is, the server will always include it. I cannot use direct paths because php will not allow it, and I can't specify the directory for each file. Example.

 

Layout.php includes files/header.php which includes lib/main.lib.

 

in Pages/Path/index.php I include ../../Layout.php. Than Layout.php's includes are all messed up

 

If you can make sense of me, please help

If your pages include your layout page, then include the file in the layout page. I have struggled with this as well.

 

All my pages in every site I build look like this...

 

<?php include('header.php') ?>


SOme Content here


<?php footer() ?>

 

In my include page, I generally have this line

 

include('etc/includes.php')

 

 

This makes all my pages have access to the includes file which contains sitewide functions and other items.

 

Hope this helps ya a little

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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.