Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Solution for Linking Pages Together 1

Status
Not open for further replies.

johngiggs

Technical User
Oct 30, 2002
492
US
I created a script which creates a webpage daily. I keep 7 days of historical reports. Before the script gets run, the page in the main directory gets moved to directory 1, what's in directory 1 gets moved to directory 2, and so on. In the webpage, I have hyperlinks to the previous days reports, however the problem is that when the report that was originally in the main directory gets moved to directory 1, the hyperlinks will not work properly anymore because of the way I have them set up (based on the page being in the main directory).

Just to clarify...
The link part of the page is set up like this:
Code:
Days Ago: <A HREF="1/test_df.html">1</A>&nbsp;
<A HREF="2/test_df.html">2</A>&nbsp;
<A HREF="3/test_df.html">3</A>&nbsp;
<A HREF="4/test_df.html">4</A>&nbsp;
<A HREF="5/test_df.html">5</A>&nbsp;
<A HREF="6/test_df.html">6</A>&nbsp;
<A HREF="7/test_df.html">7</A>
<BR>

Any suggestions as to how I can make this work without having to specify the full path (just in case I decide to move the location of the files at some point)?

Any help would be greatly appreciated.

Thanks,

John
 

>> Any suggestions as to how I can make this work without having to specify the full path

Maybe I'm missing the point... But you're not specifying the full path - you're specifying a relative path, and so I would assume that your code would still function perfectly well.

Dan
 
Billy,

I know that it would work fine if I specify the full path, but I was wondering if there is a solution using the relative path.

Right now, when I move the files from the main directory into directory 1 (a subdirectory of the main one), the link on the main page will work fine, but since the page in directory 1 has the relative path, when I click the link for 2 days ago after I am on the 1 day ago page, the link will go to 1/2/test_df.html rather than ../2/test_df.html. Perhaps there is not a relative path solution and I will just have to put the full path in...

John
 
Aah - I see.

If you add the following line to the very top of each file after you move them:

Code:
<base href="../">

that should do the trick. I've not tested this, but the logic is sound ;o)

Hope this helps,
Dan
 
if you are running apache, and you have the ability to do so, I would install mod_rewrite and create a rule for it.

___________________________________
[morse]--... ...--[/morse], Eric.
 

My apologies... I said to put the BASE tag at the very top of the page, but it should actually go within the HEAD section.

Dan
 
Dan,

Thanks for the tip about BASE!! I hadn't thought of that. It works great now.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top