Forum Moderators: coopster

Message Too Old, No Replies

Adding new articles without having to update every page?

         

knights1

3:12 am on Aug 6, 2005 (gmt 0)

10+ Year Member



When I add a new article i add it to my nave bar and I don't want to add a link on my nav bar to every page. How do I do this?

Thanks.

Zipper

4:05 am on Aug 6, 2005 (gmt 0)

10+ Year Member



just use a seperate file to enter/update your navbar contents, and include this page in every other pages using something like include()


include("navbar.php");

P.S: In order to do this all your pages should be php pages so that the include command is executable.

knights1

1:19 pm on Aug 6, 2005 (gmt 0)

10+ Year Member



what if all my pages are html so far. What do I do then? is it hard to tranfer them to PHP. I don't know PHP.

Thanks.

knights1

6:57 pm on Aug 6, 2005 (gmt 0)

10+ Year Member



ok I've found out how to parse all html pages to php...now please elaborate on where to place the include command and where and/or how to store the nav bar file. My nave bar is in a div not a frame by the way.

Zipper

8:06 pm on Aug 6, 2005 (gmt 0)

10+ Year Member



well, since your using a divisional tag for the navbar all you have to do is to put the entire division (all contents within the start and end div tags including the tags) into a seperate php file (i.e. navbar.php)..

so your navbar.php might look like

<div>
your navbar contents (html/dhtml code)
</div>

If your navbar doesn't require any php functionality it's quite ok to name it as a html file. (i.e. navbar.html)

Now that you have your navbar on a seperate file all you have to do is to include it in the right place in all the pages (php) you want it to appear. Just replace the previous navbar divisions with the php include function.

<?
include("/path/to/file/navbar.php");
?>

If you have any problems, just post a part of your html code including the navbar division so that I could break it up for you.