John Davidson

twig - Slim PHP Link to an anchor on another page

0 comments
Message:


I am working on a website using the Slim framework. I am trying to make a link that takes the user to a specific place on the home page.


This is the normal link:


<a href="{{ path_for('home') }}">Home</a>

First I tried to write an absolute link like:


<a href="https://example.com#anchor">Anchor</a>

But this doesn't work and results in https://example.com/#anchor


This doesn't work either:


<a href="{{ path_for('home#anchor') }}">Home</a>

How can I get the link to work and take me to the specified anchor?



My Answer:
html
Go to section


_If you want to link to an anchor on another page, you can simply include the page name before the anchor like this:_

html
Go to section on other page

Rate this post

4 of 5 based on 2705 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us