2013-06-27 87 views
0

我試圖生成我的HTML電子郵件模板鏈接:CakePHP 1.3。 - 與HTML幫助鏈接生成未在電子郵件模板工作

<?php echo $html->link('Find a shop', array('controller' =>'shop', 'action' => 'search'), array('escape'=>false,'target'=>'_blank')); ?> 

我希望像一個鏈接:http://shopexample.localhost/shop-search但只產生商城 - 搜索沒有http://shopexample.localhost

控制器的邏輯是使用EmailComponent

$this->Email->to   = $to; 
$this->Email->subject  = $subject; 
$this->Email->replyTo  = $replyTo; 
$this->Email->from  = "Me <".$from.">"; 
$this->Email->template = $template; 
$this->Email->body  = $body; 

$this->Email->sendAs = 'html'; 
$this->Email->smtpOptions = Configure::read('SMTP.Options'); 
$this->Email->delivery = 'smtp'; 
if($to!=null){ 
    if($this->Email->send()){ 
     $this->Email->reset(); 
    } 
} 

HTML幫助是包括在內。我正在使用CakePHP版本1.3。

感謝

回答

1

嘗試使用

<?php 
    echo $html->link('Find a shop', 
     Router::url(array('controller' =>'shop', 'action' => 'search'), true), 
     array('escape'=>false,'target'=>'_blank')); 
?> 

所以,包裹路由陣列到路由器::網址與真實參數,則這將返回完整的URL