Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-18-2008, 02:18 PM
greboguru's Avatar
Junior Member
 
Join Date: Feb 2008
Location: UK
Posts: 16
Default Zend_View_Helper_Url problems with parameters

HI,

I'm using Zend_View_Helper_Url to build up the anchor hrefs in my app. So in my view script I might have

Code:
<a href="<?php $this->url(array('controller'=>'index', 'action'=>'modify', 'id'=>'001')); ?>">link1</a>
<a href="<?php $this->url(array('controller'=>'index', 'action'=>'modify', 'id'=>'002')); ?>">link2</a>
<a href="<?php $this->url(array('controller'=>'index', 'action'=>'modify', 'id'=>'003')); ?>">link3</a>
This generates the correct links and clicking on the links takes me to the correct 'page'. My problem is that the other links eg

Code:
<a href="<?php $this->url(array('controller'=>'index', 'action'=>'add')); ?>">add</a>
now have the 'id' paremeter apended to them as well.

Any thoughts on what I'm doing wrong?

Thanks

gG
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-18-2008, 02:35 PM
greboguru's Avatar
Junior Member
 
Join Date: Feb 2008
Location: UK
Posts: 16
Default

OK, so I found the solution the helper takes additional parameters

from the zend ref guide ...

Quote:
url (line 48)

Generates an url given the name of a route.

* return: Url for the link href attribute.
* access: public

string url ([ $urlOptions = array()], [mixed $name = null], [bool $reset = false], [ $encode = true])

* array $urlOptions: Options passed to the assemble method of the Route object.
* mixed $name: The name of a Route to use. If null it will use the current Route
* bool $reset: Whether or not to reset the route defaults with those provided
* $encode
Why does the default, add the parameters to all URLS generated by this helper?

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:25 AM.