common elements php html navbar

Total Post:159


 2079  View(s)
Rate this:
Hi Everyone!

I am trying to make a template for my website. Basically taking out all the common stuff out using php's include function.

I have made a navigationbar.php and samplepage.php. navigationbar has all the links to stylesheets etc. When they are in the same folder and I include navigationbar.php in samplepage it works just fine.

However when i move samplepage.php to a subdirectory (leaving navigationbar.php in the same folder) and link navigationbar.php with the menu doesn't come formatted. it seems samplepage is getting contents from navigationbar.php but navigationbar is not linking to the css files.

Can anyone tell what I'm doing wrong here? i'm using xampp and have tried with both relative and absolute paths- (include '../navigation.php' and 'localhost/folder/navigation.php')

Thanks in advance!

  1. Re: common elements php html navbar

    Hi Samuel!

    Try using something along the lines of this to link to your header/footer files:

    and then appropriately link to your .js/.css files within header.


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.