Linking to named anchors on static...

User 364143 Photo


Guest
5,410 posts

You can also use JavaScript to form internal page anchors that scroll smoothly instead of jumping to the page location. ;)

http://www.kryogenix.org/code/browser/smoothscroll/

CoffeeCup... Yeah, they are the best!
User 1948478 Photo


Senior Advisor
1,850 posts

Hi again Alan,

Clearly, I should not have been doing this late at night, following a rough day...!!

1. As for my typing of "pnp" versus "php": I must have a case of selective dyslexia, at least after midnight... All should, of course, be "php".

2. Disclaimer: I have only used this anchor tag in html pages, but I'm assuming that a .php page would work exactly the same way by just replacing "html" with "php" in the link reference. This may need to be verified, though.

So for clarity, yet again, the link to the anchor tag in an html page would look like this:

<a href="static_pagename.html#Teflon®_Fabric_Protector_by_DuPont®_">Link Text Here</a>

The name "Teflon®_Fabric_Protector_by_DuPont®_" for your anchor, sometimes has an underscore at the end and sometimes not in your posts. Make sure you end up with name consistency between anchor and link! With long names like that, having a mix of lc, uc, underscores and special characters, it would be easy to get a character wrong here and there. You may want to consider simplifying your names... ;)

Let us know how you get on!
User 562592 Photo


Registered User
2,038 posts

Per wrote:
Hi again Alan,

Clearly, I should not have been doing this late at night, following a rough day...!!

1. As for my typing of "pnp" versus "php": I must have a case of selective dyslexia, at least after midnight... All should, of course, be "php".

2. Disclaimer: I have only used this anchor tag in html pages, but I'm assuming that a .php page would work exactly the same way by just replacing "html" with "php" in the link reference. This may need to be verified, though.

So for clarity, yet again, the link to the anchor tag in an html page would look like this:

<a href="static_pagename.html#Teflon®_Fabric_Protector_by_DuPont®_">Link Text Here</a>

The name "Teflon®_Fabric_Protector_by_DuPont®_" for your anchor, sometimes has an underscore at the end and sometimes not in your posts. Make sure you end up with name consistency between anchor and link! With long names like that, having a mix of lc, uc, underscores and special characters, it would be easy to get a character wrong here and there. You may want to consider simplifying your names... ;)

Let us know how you get on!


Just because now I need some clarity. You seemed to leave out the .php, instead replacing it with .html. I am assuming it doesn't matter, but our guest may not know that. :D
The philosopher has not done philosophy until he has acted upon the mere conviction of his idea; for proof of the theory is in the act, not the idea.

My Web Development Company: http://www.innovatewebdevelopment.com (Created with Coffee Cup Software).

My Personal Website: http://www.EricSEnglish.com

User 1948478 Photo


Senior Advisor
1,850 posts

Eric English wrote:
Just because now I need some clarity. You seemed to leave out the .php, instead replacing it with .html. I am assuming it doesn't matter, but our guest may not know that.

Oh, but I think it does matter!
As I was explaining in my disclaimer:
Per wrote:
Disclaimer: I have only used this anchor tag in html pages, but I'm assuming that a .php page would work exactly the same way by just replacing "html" with "php" in the link reference. This may need to be verified, though.

I was hoping that someone, e.g. Eric English (:)), would jump in here and confirm that the syntax and the hash sign would be used the same way for a .php page as it is for a .html page, so that the letters "html" could simply be replaced by "php" and the link would still be valid.
User 364143 Photo


Guest
5,410 posts

Yes, but did you save any money on your car insurance?

http://www1.american.edu/newsletter/development/2007/images/gecko_0207.jpg
CoffeeCup... Yeah, they are the best!
User 122279 Photo


Senior Advisor
14,622 posts
Online Now

Per and anybody else who might wonder, the anchor with # works fine in php pages. I have used it several times.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 1948478 Photo


Senior Advisor
1,850 posts

Thank you Inger!
User 364143 Photo


Guest
5,410 posts

Don't all valid HTML markup tags work in PHP?
CoffeeCup... Yeah, they are the best!
User 562592 Photo


Registered User
2,038 posts

The Joker wrote:
Don't all valid HTML markup tags work in PHP?


Only in an ideal world. Much like the one where we all "actually" save money on car insurance. Actually, I have Geico and only because of the little lizard. He's English, so you have to trust him, right.
The philosopher has not done philosophy until he has acted upon the mere conviction of his idea; for proof of the theory is in the act, not the idea.

My Web Development Company: http://www.innovatewebdevelopment.com (Created with Coffee Cup Software).

My Personal Website: http://www.EricSEnglish.com

User 364143 Photo


Guest
5,410 posts

Oh, so it all boils down to this not being the ideal world where we have control over everything we would like? Makes sense to me. :)

To answer your other question, who knows...
CoffeeCup... Yeah, they are the best!

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.