/    Sign up×
Community /Pin to ProfileBookmark

Including a Navigation

I wanted to use the PHP include function to include a completely separate page into the pages on my site. The page would hold all of the navigation links, and that way if I needed to change the navigation, it wouldn’t be very difficult. However, would this mess up the page and layout, or is there an easier way to do this.

Thanks for any help.

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@knowjAug 06.2007 — it wouldn't be a separate page you would have something like this:

navigation.htm
<i>
</i>&lt;div id="nav"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#"&gt;Link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Link&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Link&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;


yourfile.php
[code=php]
<?php
//the navigation file is required for this document
require 'navigation.htm';
?>
[/code]


it will include the navigation.htm into the yourfile.php as if it was part of it with no extra code or destruction of the layout/style
Copy linkTweet thisAlerts:
@AscendancyauthorAug 06.2007 — Yea that's what I meant, I wasn't sure though. Do you know how I could do that with a .html page? Let's say that I have page.html, and I want to include a navigation into that page. It's not a PHP page, so I can't put the code directly onto the page, but is there a way to still include the navigation?
Copy linkTweet thisAlerts:
@TJ111Aug 06.2007 — Keep your page layout exactly the same, just break it up where you need to and then include all the parts in order. Since PHP is all server-side, your website source will look exactly the same to the browser.

Edit: You can include the code directly onto the .html page. The php will still interpret it anyway.
Copy linkTweet thisAlerts:
@knowjAug 06.2007 — have a .htaccess file in your route with this:
<i>
</i>AddType application/x-httpd-php .html .htm .phtml .php

you can make a .htaccess file in word just have that as the only line in it.

That will add .html .htm .phtm .php as extensions in which php can run from
Copy linkTweet thisAlerts:
@AscendancyauthorAug 06.2007 — Oh okay, thanks for the help guys.
×

Success!

Help @Ascendancy 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.18,
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,
)...