Search code examples
symfony1symfony-1.4

Passing host to link_to


I'm trying to send a link in an email, using a partial:

$html = $this->getPartial('templates/myTemplateHtml', array('id'=>$id));

_myTemplateHTML

<p><?php echo link_to('Moderate Template', '@template_moderate?id='.$id); ?></p>

When I receive the email, I get the Moderate Link, how do I modify the link_to() to include the URL that the email was sent from?


Solution

  • If you want the full link to your host, you should enable the absolute option:

    • 'absolute' - if set to true, the helper outputs an absolute URL

    This will give you this:

    link_to(
      'Moderate Template', 
      '@template_moderate?id='.$id, 
      array('absolute' => true)
    );