Creates an <input> button tag of the given name pointing to a routed URL
based on the module/action passed as argument and the routing configuration.
The syntax is similar to the one of link_to.
Options: - 'absolute' - if set to true, the helper outputs an absolute URL
- 'query_string' - to append a query string (starting by ?) to the routed url
- 'confirm' - displays a javascript confirmation alert when the button is clicked
- 'popup' - if set to true, the button opens a new browser window
- 'post' - if set to true, the button submits a POST request instead of GET (caution: do not use inside a form)
Examples: echo button_to('Delete this page', 'my_module/my_action');
=>
Creates a <a> link tag of the given name using a routed URL
based on the module/action passed as argument and the routing configuration.
It's also possible to pass a string instead of a module/action pair to
get a link tag that just points without consideration.
If null is passed as a name, the link itself will become the name.
If an object is passed as a name, the object string representation is used.
One of the options serves for for creating javascript confirm alerts where
if you pass 'confirm' => 'Are you sure?', the link will be guarded
with a JS popup asking that question. If the user accepts, the link is processed,
otherwise not.
Options: - 'absolute' - if set to true, the helper outputs an absolute URL
- 'query_string' - to append a query string (starting by ?) to the routed url
- 'confirm' - displays a javascript confirmation alert when the link is clicked
- 'popup' - if set to true, the link opens a new browser window
- 'post' - if set to true, the link submits a POST request instead of GET (caution: do not use inside a form)
Note: The 'popup' and 'post' options are not compatible with each other.
Examples: echo link_to('Delete this page', 'my_module/my_action');
=> Delete this page echo link_to('Visit Hoogle', 'http://www.hoogle.com');
=> Visit Hoogle echo link_to('Delete this page', 'my_module/my_action', array('id' => 'myid', 'confirm' => 'Are you sure?', 'absolute' => true));
=> Delete this page
Options: - 'tag' - the HTML tag that must enclose the name if the condition is false, defaults to - 'absolute' - if set to true, the helper outputs an absolute URL
- 'query_string' - to append a query string (starting by ?) to the routed url
- 'confirm' - displays a javascript confirmation alert when the link is clicked
- 'popup' - if set to true, the link opens a new browser window
- 'post' - if set to true, the link submits a POST request instead of GET (caution: do not use inside a form)
Examples: echo link_to_if($user->isAdministrator(), 'Delete this page', 'my_module/my_action');
=> Delete this page echo link_to_if(!$user->isAdministrator(), 'Delete this page', 'my_module/my_action');
=> Delete this page
Options: - 'tag' - the HTML tag that must enclose the name if the condition is true, defaults to - 'absolute' - if set to true, the helper outputs an absolute URL
- 'query_string' - to append a query string (starting by ?) to the routed url
- 'confirm' - displays a javascript confirmation alert when the link is clicked
- 'popup' - if set to true, the link opens a new browser window
- 'post' - if set to true, the link submits a POST request instead of GET (caution: do not use inside a form)
Examples: echo link_to_unless($user->isAdministrator(), 'Delete this page', 'my_module/my_action');
=> Delete this page echo link_to_unless(!$user->isAdministrator(), 'Delete this page', 'my_module/my_action');
=> Delete this page
Creates a <a> link tag to the given email (with href="mailto:...").
If null is passed as a name, the email itself will become the name.
Options: - 'encode' - if set to true, the email address appears with various random encoding for each letter.
The mail link still works when encoded, but the address doesn't appear in clear
in the source. Use it to prevent spam (efficiency not guaranteed).
Examples: echo mail_to('webmaster@example.com');
=> webmaster@example.com echo mail_to('webmaster@example.com', 'send us an email');
=> send us an email echo mail_to('webmaster@example.com', 'send us an email', array('encode' => true));
=> send us an email
Since 1998, Sensio Labs has been promoting the Open-Source software
movement by providing quality web application development, training,
consulting. Sensio Labs also supports several large
Open-Source projects.