|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Anchor Links using PHP
Hello . . .
I am looking for some specific syntax for using anchors in PHP pages. The goal: I have a menu list on my website - - Links on that menu bring you to a page that has different sections on it - - Where and how do I place the anchor tags (href and the closing tag) to make it scroll automagically to the topic selected. Any help would be great. Thanks |
|
#2
|
||||
|
||||
|
Just as in html, show code!
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
|
#3
|
|||
|
|||
|
This should do the job:
Long text with sections: Code:
... <a name="ntro">Introduction</a> ... <a name="aims">Our Aims</a> ... <a name="end">Finally ...</a> ... Menu (PHP output): Code:
... <a target="right" href="longfile.html#aims">Aims</a> ...
__________________
PHP manual | MySQL manual | Apache docs | Linux Documentation Project | Free Software Foundation Smart Questions HOWTO | PHP security | PHP FAQ | Posting HOWTO Wikipedia | English dictionary | Google | News | RFCs Thus Spoke Zarathustra | A Skeptic's Guide to Christianity | Project Gutenberg | Skeptic's Annotated Bible ParEcon | Marxists Internet Archive | The Memory Hole | Landover Baptist | DHMO Research Universal Declaration of Human Rights | UN Charter | Geneva Conventions Sinfest | Chopping Block | Filthy Lies | Bob the Angry Flower | How to Shoot Yourself In the Foot |
|
#4
|
|||
|
|||
|
Continuation . . .
Hello . . .
Thanks for the quick response. I have one more question based on the example from 'realnowhereman' From your example: <a target="right" href="longfile.html#aims">Aims</a> will using the file "longfile.php#aims" work the same as it does in html? I have a menu name and then the actually url is not viewable. The url calls a php page not an html page. Any suggestions or coding suggestions for this type of situation? Thanks SJW |
|
#5
|
|||
|
|||
|
The # character in the URL is interpreted by the browser. It requests the file as usual (without the #mark appendix), the looks for an anchor with the given name. This should work fine with PHP, if the PHP-generated code contains the anchors.
(The above is mainly guessed, but today's been my lucky day ) |
|
#6
|
|||
|
|||
|
Thanks for the help. It worked just as needed.
Once the anchor was set in the php page. On my menu all I had to do was place the #nameofanchor after the php page. It looked like this: test.php#link1 |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > Anchor Links using PHP |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|