PHP include navbar - multiple directories

mattbtay

New Member
what is the best practice to link to a page within the site from 2 different levels of directory

ex.

site.com/path/to/file/1.html

and

site.com/path/to/listing.html

both of those need to have a link to "site.com/index.html" I am using an navbar which is being included via php so i have to have the same link for the whole site. is my only option to use the full url for the page?

http://www.site.com/index.hml ?
 

bcee

New Member
Just use the full URL, I think it would be better for SEO anyhow.

But to solve your problem I've had to do this before. What I ended up doing was using a PHP variable that stores the current page ($_SESSION['page'] = 'home' BEFORE the include) and you can echo the links you want based on that page in your header PHP.
 

web_design

New Member
you may have some issues using the full path as someservers wont allow it. that said its the easiest way of doing what you want if yourserver supports it
 
Top