This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » development » Documentation » link_to documentation confusion
link_to documentation confusion [message #75749] Fri, 27 March 2009 16:37 Go to next message
jasvrcek  is currently offline jasvrcek
Messages: 2
Registered: March 2009
Location: New York
Junior Member
I am following the Jobeet tutorial, which uses the link_to helper in many places like the following:

<?php echo link_to('Extend', 'job_extend', $job, array('method' => 'put')) ?>


The API docs describe the link_to method as:

(string) link_to ($name, $internal_uri, $options)

$name = name of the link
$internal_uri = 'module/action' or '@rule' of the action
$options = additional HTML compliant <a> tag parameters

http://www.symfony-project.org/api/1_2/UrlHelper#method_link _to


What is the fourth arg used by the Jobeet tutorial? Is the API documentation old?
Re: link_to documentation confusion [message #80124 is a reply to message #75749 ] Thu, 18 June 2009 13:19 Go to previous message
Russ  is currently offline Russ
Messages: 413
Registered: August 2008
Location: Oslo, Norway
Faithful Member

It looks like when you are dealing with objects, you pass the object as the third parameter and then any options as the fourth.

In the link_to functions, the object is merged into the options array as part of the options, so if I read it right the code you supplied would be the same as doing this:

<?php echo link_to('Extend', 'job_extend', array('method' => 'put', 'sf_subject' => $job)) ?>

or something...


*On Freenode I am rooster*
http://www.walkandclimb.co.uk/images/monkeydust.jpghttp://www.walkandclimb.co.uk/userpix/2_linux_wave_small_2.jpg
Previous Topic:INSERT INTO
Next Topic:[tutorial] How to create a custom validator in 1.1
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software