Friday, October 31, 2008

Re: Fatal error Call to undefined method Controller Html()

> <?php echo $html->link('Activate account',
> array('controller'=>'users', 'action' => 'activate', $userid); ?>

^
it's missing a close bracket here ---------------------------------^

anyway:

> Is there a way the above can be used to print out an absolute url ?

$html->link('Activate account', $html-
>url(array('controller'=>'users', 'action' => 'activate', $userid),
true));
or
$html->link('Activate account',
Helper::url(array('controller'=>'users', 'action' => 'activate',
$userid), true));
or
$html->link('Activate account',
Router::url(array('controller'=>'users', 'action' => 'activate',
$userid), true));

-the boring explanation:
you can use Router::url/Helper::url passing true as the second param
to get the full route out of the url you passed in the first param.
in case you ever extend Helper::url on AppHelper, use $html->url()
to use the overrided method.

LAST BUT CERTAINLY NOT LEAST,
CakePHP has documentation and API specifications that cover this
feature, please refer to http://api.cakephp.org and http://manual.cakephp.org
as often as possible to get in touch with all the features, power and
might and magic of CakePHP.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: