Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-24-2005, 01:39 AM   #1
Senior Member
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 9.2
Posts: 1,062

Rep: Reputation: 48
html links from various sources

I have a site under construction with hundreds of pages so far and I am finding an increasing need to be able to link to specific parts of the site from various places in other html documents and returning to the document that linked to this part.

Although I am not familiar with it, I think Javascript uses "include()" to do this but Javascript could be turned off on the client.

How can I obtain the result I want in plain HTML or using CSS (if possible at all)?
Or should I use PHP (if so can you give an example of the code necessary)?

I am prepared to reorganize the whole site if necessary.
Any hint most welcome.
Old 11-24-2005, 03:59 AM   #2
Senior Member
Registered: Jan 2002
Location: St Louis, MO
Distribution: Ubuntu
Posts: 1,284

Rep: Reputation: 47
Not sure about with JavaScript tracking, but within PHP you'd create your link along the lines of:
<a href='page.php?referal=currentpage'>link</a>
On the page you're linking too, you then read in the variable 'referal' and create your link back:
<a href='$referal.php'>back</a>
Bear in mind you'd need to pass the actual name of the page in order to link back correctly and you might need to include the full location if you're moving between directories.

An alternative if you want to use JavaScript and depending on how much control you want, would be something like:
<a href="javascript:history.back(1)">back</a>
Old 11-24-2005, 11:32 PM   #3
Senior Member
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 9.2
Posts: 1,062

Original Poster
Rep: Reputation: 48
Thank you fouldsy, I'll probably try the PHP option.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I automatically open HTML links sent in emails? bad_andy Linux - General 6 01-01-2005 08:42 AM
HTML links in signatures? BajaNick LQ Suggestions & Feedback 3 12-20-2004 03:32 AM
copy HTML and paste links TxLonghorn Linux - Software 2 02-24-2004 11:56 PM
Duplicate Links In Bookmarks.html MarcRJacobs Linux - Newbie 0 06-11-2003 02:29 PM
Can't open html links in email Glock Shooter Linux - Newbie 1 06-04-2002 01:42 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:41 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration