Jump to content

[SOLVED] loading info to place inside div...


Drags111

Recommended Posts

Hello there! im making my first website, and i have a quick question. What I want to do is have a php script load the info for a navigation bar that i have and i want the php to display the navigation bar inside the page. Like for instance, i have a file called navbarinfo.whatever and the script loads that and displays the nav bar using the info found there. This way i wont have to change the nav bar on every html page i have when i add a new section. I'm positive this is possible, how do i do it? Much thanks!

-Justin

Link to comment
Share on other sites

ok so i tried it out and i made a php file called mainnav.php with this code:

	<h1 class="mnh"> <a href="index.html" class="mnlink"><b>HOME</b></a>  </h1>
<div id="headervr"></div>
<h1 class="mnh"> <a href="/comedy/index.html" class="mnlink"><b>COMEDY</b></a>  </h1>
<div id="headervr"></div>

 

and in the section where i belongs i put

				<div id="headerdiv">
				<h1 class="headerh"> <b>jdubya</b> </h1>
				<h1 class="com"> .com </h1>
				<div id="headerhr"> </div>
				<?php include("mainnav.php"); ?>
			</div>

Its working, however. It just doesnt show up. Can anyone see what i'm doing wrong?

 

 

Link to comment
Share on other sites

Place mainnav.php in your sites root folder (where you upload your sites content too). Now use

 

include($_SERVER['DOCUMENT_ROOT']."/mainnav.php");

 

PHP will now always include mainnav.php from your sites root folder no matter where its included from.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.