General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 15th, 2003, 05:22 AM
fakker fakker is offline
The calm b4 the storm
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Manchester, UK
Posts: 404 fakker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via Yahoo to fakker
menu include - hyperlink problems

hey,

I have a structure like the following

ROOT
> index.php
> menu.php
> header.php
> content.php

FOLDER1
> content.php
> another.php
> index.php

so there are many folders at root, that all have an index file. When I call say index.php in root, the links to other parts of the site would be like

<a href="folder1/index.php">Folder 1 index</a>

but when that index file in folder1 is opened, it includes the menu and header file from root... so the index in folder1 has

include ('../menu.php')

etc

but obviously, the links in menu still refer to original paths.... so if I wanted to go back to the home page, it should be

"../index.php" but it is still "index.php"

Basically, I think I need a way to dertmine if the menu is being called in the root dir, then display a certain path, or if the menu is a folder away from root, to display other paths..

has anyone come across this problem, I'm sure you must have!!

thanks!!
__________________
Matt 'Fakker' Facer

mattfacer.com

Reply With Quote
  #2  
Old September 15th, 2003, 07:46 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
You might investigate splitting the URL on slashes and counting your elements to determine where in the tree you are. So:

PHP Code:
 $parts=split("/",getenv("DOCUMENT_URI"));
$num_dots=sizeof($parts)-3;

switch(
$num_dots){
    case 
1:
        
$dots="../";
        break;
    case 
2:
        
$dots="../../";
        break;
    default:
        
$dots="/";        
}

include(
$dots "index.php"); 

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > menu include - hyperlink problems


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT