Better usability when switching between detail and list views
You can enhance the usability of your web page or application when redirecting from a detail view back to a list view by scrolling the list to the entry that was just edited. This is done with a fragment identifier in the URL, also called "anchor" and a matching id in each of the entries in the list.
Let's say your list view looks like this:
<div id="entry_1"> Big chunk of text 1. </div> ... <div id="entry_42"> Big chunk of text 42. </div>
To scroll the list to entry number 42, you must create a URL like this:
However, the standard URL and redirection helpers like
gotoSimpleAndExit in the current Zend Framework release don't have a parameter for fragment identifiers. But it's possible to use
gotoUrlAndExit and add the fragment to a generated URL:
$url = $this->_helper->url('index', 'entries').'#entry_'.$id; $this->_redirector->gotoUrlAndExit($url, array('prependBase' => false));
prependBase is important, otherwise the base URL will be added twice, if you have it configured.