user1970557
user1970557

Reputation: 515

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?

Upvotes: 0

Views: 65

Answers (1)

j0k
j0k

Reputation: 22756

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)
);

Upvotes: 2

Related Questions