Hi,

I am successfully using $this->_helper->url in my controller but it's syntax
seems to differ from the view version.

In a view I can do:

$this->url(array('pageTitle'=> $this->title, 'groupKey' => $this->groupKey),
'view');

If I try this in a controller e.g.

$this->_helper->url(array('pageTitle'=> $this->title, 'groupKey' =>
$this->groupKey), 'view');

I get the following:

/view/Array in my view

The only way I can get it to work is by doing:

echo $this->_helper->url($this->title, this->groupKey, 'view');

Is this correct?

Cheers,
- Robert


-----Original Message-----
From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] 
Sent: 08 July 2008 17:51
To: fw-general@lists.zend.com
Subject: Re: [fw-general] Re: Re[fw-general] direct Question

-- Robert Castley <[EMAIL PROTECTED]> wrote (on Tuesday, 08 July
2008, 05:05 PM +0100):
> I am having a similar problem.  In my controller I would like to specify a
URL.
> 
> Currently I am using: $this->view->saveUrl = $this->_baseUrl . '/save/' .
> $this->_groupKey . '/' . $this->_pageTitle;
> 
> I tried the redirector approach but obviously that redirects straight
away.
> 
> Is there another method to build up urls in the controller.  Much akin 
> to the $this->url in the view.

Yes -- there is a url() action helper that works just like its cousin in the
view helpers:

    $this->view->saveUrl = $this->_helper->url(...);


> -----Original Message-----
> From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED]
> Sent: 08 July 2008 16:18
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] Re: Re[fw-general] direct Question
> 
> -- monk.e.boy <[EMAIL PROTECTED]> wrote (on Tuesday, 08 July 
> 2008,
> 07:36 AM -0700):
> > Matthew Weier O'Phinney-3 wrote:
> > >
> > >
> > > Use the redirector instead of constructing the URL yourself:
> > >
> > >     $this->_helper->redirector('project');
> > >
> > > This will do the same as what you were trying to accomplish before.
> > > --
> > > Matthew Weier O'Phinney
> > >
> > >
> >
> > Matt,
> >
> >   Thanks for the promp reply!
> >
> >   Does the redirector act like the URL constructor? My URL looks like
this:
> >
> >   /base/application/report/customer/33/project/12/report/99/
> >
> > Doing this:
> >   $this->_helper->redirector('report')
> >
> > takes me to:
> >   /base/application/report/
> >
> > How do you suggest I build and pass the URL above to the redirector?
> 
> If you want to do url()-like redirection, use the gotoRoute() method 
> of the
> redirector:
> 
>     $this->_helper->redirector->gotoRoute(array('action' => 
> 'project'));
> 
> It takes the same arguments as the url() view helper, and builds using 
> the same mechanisms.
> 
> > At the
> > moment I do a lot of:
> >
> > '/base/application/report/customer/'. $this->_getParam( 'customer' )
.'/'.
> > $this->_getParam( 'project' ) .'/report/'. $this->_getParam( 'report'
> > )
> >
> > which makes me feel icky :-(
> 
> --
> Matthew Weier O'Phinney
> Software Architect       | [EMAIL PROTECTED]
> Zend Framework           | http://framework.zend.com/
> 
> ______________________________________________________________________
> __ This email has been scanned for all known viruses by the 
> MessageLabs Email Security Service and the Macro 4 plc internal virus 
> protection system.
> 
> ______________________________________________________________________
> __
> 
> 
> ______________________________________________________________________
> __ This email has been scanned for all known viruses by the 
> MessageLabs Email Security Service and the Macro 4 plc internal virus 
> protection system.
> ______________________________________________________________________
> __

--
Matthew Weier O'Phinney
Software Architect       | [EMAIL PROTECTED]
Zend Framework           | http://framework.zend.com/

________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email
Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________


________________________________________________________________________
This email has been scanned for all known viruses by the MessageLabs Email 
Security Service and the Macro 4 plc internal virus protection system.
________________________________________________________________________

Reply via email to