0

In zf2, how do we write the routing to point to a bookmark in a page? For example, if a target page had this:

<h2 id="tips">Useful Tips Section</h2>

and we want the router to generate this:

<a href="target_page#tips">Visit the Useful Tips Section</a>

what route types should be used and what's the syntax?

jcropp
  • 1,236
  • 2
  • 10
  • 29
  • You can use the `fragment` option of the URL view helper, as described [here](http://stackoverflow.com/questions/22154357/zf2-url-helper-customization-to-add-achnor-for-angularjs-router#22162928). – AlexP Oct 26 '15 at 20:28

2 Answers2

1
<a href="<?= $this->url('your_route', [], ['fragment' => 'tips']) ?>">...</a>
B.Asselin
  • 978
  • 10
  • 19
1

The fragments option of the URL View Helper can be used for this purpose. Fragments can also be used in Controller Plugins like the Redirect Plugin.

jcropp
  • 1,236
  • 2
  • 10
  • 29