I can see this being useful to many people, too. Maybe instead of a 5th
parameter, there can be a setHash() method. So usage would be like this:

$redirector = $this->_helper->redirector;
$redirector->gotoRoute(/* ... */);
*$redirector->setHash('add');*
$redirector->redirectAndExit();

--
Hector


On Thu, Dec 10, 2009 at 11:53 AM, Jason Austin <[email protected]>wrote:

> Thanks guys.  The most straight forward way was using the URL helper,
> adding the hash to the end of the URL, then using gotoUrl().  One
> caveat was that I had to do the following to not get the baseUrl() to
> be added twice:
>
>
> $this->_helper->redirector->setPrependBase('')->gotoUrl($this->_helper->url->url(array(..options...),
> 'default', true) . '#hash');
>
> If you don't setPrependBase to '' in the redirector you will get
> something like http://mywebsite.com/subdir/subdir/module/... instead
> of http://mywebsite.com/subdir/module/...
>
> Hope this helps.  I smell a feature request for adding hashes to
> routes & url helpers :)
>
> Thanks!
> Jason
>
> On Thu, Dec 10, 2009 at 1:09 PM, Hector Virgen <[email protected]> wrote:
> > It should be possible to extend the redirector helper to create your own
> > that accepts a hash as the 5th parameter. Since the action helper broker
> > uses a LIFO stack, you can even use the same helper name "redirector".
> >
> > --
> > Hector
> >
> >
> > On Thu, Dec 10, 2009 at 10:06 AM, Fred Jiles <[email protected]>
> wrote:
> >>
> >> Maybe one could add a target to the gotoRoute method in the future.  I
> >> can't believe that people don't need to do something like this often.
> >> Similar to
> >> $url = $this->_helper->url->url(array('module' => 'blog',
> >> 'controller' => 'documentation', 'action' => 'tags', 'anchor'
> >> =>'comments'));
> >>
> >>
> >> On Thu, Dec 10, 2009 at 1:02 PM, Hector Virgen <[email protected]>
> wrote:
> >>>
> >>> The gotoRoute() method doesn't support hashes, but you can accomplish
> >>> this by using the url action helper to construct the url based on your
> >>> route, and then concatenate your hash to it. Then call the redirector's
> >>> gotoUrl method:
> >>> $url = $this->_helper->url->url(array('module' => 'blog',
> >>> 'controller' => 'documentation', 'action' => 'tags'));
> >>> $url .= "#add";
> >>> $this->_helper->redirector->gotoUrl($url);
> >>> --
> >>> Hector
> >>>
> >>>
> >>> On Wed, Dec 9, 2009 at 1:51 PM, Jason Austin <[email protected]>
> >>> wrote:
> >>>>
> >>>> I am trying to use the redirector action helper to call gotoRoute.
> >>>> The page I need to go to is something like
> >>>> http://mywebsite.com/blog/documentation/tags/#add which would take me
> >>>> to the "add" anchor in the tags page.  To go to that URL, my code is:
> >>>>
> >>>> $this->_helper->redirector->gotoRoute(array('module' => 'blog',
> >>>> 'controller' => 'documentation', 'action' => 'tags'));
> >>>>
> >>>> That takes me to http://mywebsite.com/blog/documentation/tags/ but I
> >>>> need to add "#add" to the end of that.  Any idea how one would
> >>>> accomplish that?
> >>>>
> >>>> Thanks
> >>>> Jason
> >>>>
> >>>> --
> >>>> Jason Austin
> >>>> Senior Solutions Implementation Engineer
> >>>> NCSU - OIT - Outreach Technology
> >>>> [email protected]
> >>>
> >>
> >
> >
>
>
>
> --
> Jason Austin
> Senior Solutions Implementation Engineer
> NCSU - OIT - Outreach Technology
> [email protected]
>

Reply via email to