Page 1 of 1
Using a navigation bar from a seperate PHP file
Posted: Sat Dec 16, 2006 10:47 am
by impulse()
I've created a navigation bar that's held in it's own PHP file that I want to be displayed on each other page of my website but I'm having trouble outputting the file as PHP code rather than just echoing the contents of the file.
I get that output when I use
. Can you suggest another way to do this?
Regards,
Posted: Sat Dec 16, 2006 10:54 am
by feyd
I have no idea what you are talking about. Can you post the code and try explaining again?
Posted: Sat Dec 16, 2006 11:11 am
by impulse()
I have a navigation bar, something along the lines of
Code: Select all
<table width = '80%'>
<td>
<a href = 'http://a.com'> Link </a>
</td>
</table>
Which is stored in nav.php. I want that nav bar to be at the top of every other page.
On index.php I have:
But it displays the contents of nav.php and I want it to use the code from nav.php so it leaves me only having to update 1 file and the changes are seen on all pages.
Posted: Sat Dec 16, 2006 11:15 am
by volka
Are you looking for file_get_contents() ?
Posted: Sat Dec 16, 2006 11:23 am
by d3ad1ysp0rk
Change it to include("nav.php");