Page 1 of 1

linking pages

Posted: Sat Feb 26, 2011 9:43 am
by amirbwb
hello .. i'm creating a website but i faced a problem in the page structure ...
i want in the bottom to each page to have a small bar like the menu bar example http://www.psd2html.com/
so i created a page call nav.php in a directory named "inc".

let's say that nav.php contain this code:

[text]<div>
<ul>
<li><a href="index.php">home</a></li>
<li><a href="about.php">about</a></li>
<ul>
</div>[/text]

in the public_html/index.php when i use
require('inc/nav.php');
every thing work fine but when i enter to a directory lets say public_html/admin/index.php
and i use require('../inc/nav.php');

the text appears but the link are not correct for the <li>about<li> it will post public_html/admin/about.php
i wanted to be updated automaticaly in each page like this public_html/about.php

In fact i am using this method to not repeat the same code in each page and if i want to update it i will update it one time only ...
thanks for help hope u understand what i want ...

Re: linking pages

Posted: Sat Feb 26, 2011 11:09 am
by DigitalMind

Code: Select all

<a href="/index.php">home</a>
<a href="/about.php">about</a>
Is that what you want?

Re: linking pages

Posted: Sat Feb 26, 2011 11:39 am
by amirbwb
noo i want them to be in the admin directory index page <a href="../index.php">home</a>
and in the homepage (public_html/index.php) <a href="index.php">home</a>

but i want to require the same page each time ...

Re: linking pages

Posted: Sat Feb 26, 2011 11:47 am
by DigitalMind
I thought my code solves the issue. Did you try it?

Re: linking pages

Posted: Sat Feb 26, 2011 11:54 am
by amirbwb
yeah yeah sory i didn't pay attention to the " / " .. thanks for ur helppppp ... ^^