1 to 4 of 4
Hi.
I know 2 methods :
function buildLink( $url = null )
{
if( empty( $url ) )
$url = $this->_controller->url_for( array( 'controller'=>'mycontroller', 'action'=>'myaction' ) );
return( $this->_controller->t( 'Click on <a href="%url">this link</a>', array( '%url' => $url ) ) );
}
<%= buildLink ( url_for :action => 'mycontroller', :action => 'myaction' ) %>
<% url = url_for :action => 'mycontroller', :action => 'myaction' %>
_{Click on <a href="%url">this link</a>}
The traduction directive should automatically expend to this:
<?php echo $text_helper->translate( 'Click on <a href="%url">this link</a>', array('%url => @$url)); ?>
You can assign the $url variable in the controller if you don't like it in the template.
P.S : I didn't test it, maybe it needs some adjustments. P.S.2 : Those < replacements suck :p
Shorter using Sintags
<%= t "Click on <a href='#{url_for :controller=>'mycontroller',:action=>'myaction'}'>this link</a>" %>
1 to 4 of 4