/    Sign up×
Community /Pin to ProfileBookmark

I heard that you can use PHP to make navigation bars, without having to change each file every time that you add something to the navigation bar.

How do I do this, if it is possible?

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@SheldonSep 23.2005 — make your navigation menu/bar just like normal, save it in its own file for this instance we will call is [b]nav.php[/b].

Then in each page place this code exactly where you want the navigation menu to be.

[code=php]
<?php
//include the navigation menu.
include('path/to/nav.php');
?>
[/code]


Make sur ethe path is correct or if it is in the same folder just have the name of the file there.


Let me know how that goes
Copy linkTweet thisAlerts:
@SheldonSep 23.2005 — Oh i forgot to say, all of your pages that will include the nav.php must now have the extension [b].php[/b] so you may have to change the links in your like to match, else there is a way in i think either your php.ini file or your httpd.conf file to pharse .html files as .php
Copy linkTweet thisAlerts:
@SpectreReturnsSep 23.2005 — Or you can make your webserver parse .html files.
Copy linkTweet thisAlerts:
@SheldonSep 23.2005 — Or you can make your webserver parse .html files.[/QUOTE]
Yes thats what i said in the post above.
Copy linkTweet thisAlerts:
@The_Little_GuyauthorSep 23.2005 — cool thanks, Im glad I didn't start to make the files yet ?
Copy linkTweet thisAlerts:
@SheldonSep 23.2005 — remember no to write the
<i>
</i>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;meta's&gt;
&lt;/head&gt;
&lt;body&gt;
in every page, just the page that for instance is your header file, that way you can edit it once and include that in each page too.

Refer to this [url=http://www.webdeveloper.com/forum/showthread.php?t=79373]thread[/url] for more ideas!
Copy linkTweet thisAlerts:
@SheldonSep 23.2005 — http://www.speedsurf.to/akick/akick.html

http://www.speedsurf.to/rbg/rbg.html[/quote]

Neither links on your sig works? Is it just me but i got a page not found?
Copy linkTweet thisAlerts:
@The_Little_GuyauthorSep 27.2005 — Neither links on your sig works? Is it just me but i got a page not found?[/QUOTE]

Yeah that is becuase someone didn't follow the rules, and everyones pages got deleted, and I havn't started over since then.
×

Success!

Help @The_Little_Guy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...