截断与CakePHP的链接

时间:2011-09-22 07:29:45

标签: cakephp cakephp-1.3

如何通过CakePHP中的Html Helper截断链接?

这本书只截断文本字符串,但是如何截断这样的链接?

$this->Html->link('This is a very long link that needs to be truncated', '/pages/home', array('class' => 'button', 'target' => '_blank'));

由于

1 个答案:

答案 0 :(得分:6)

将使用情况与TextHelper :: truncate方法结合使用。例如:

$this->Html->link(
    $this->Text->truncate('This is a very long link that needs to be truncated'),
    '/pages/home',
    array('class' => 'button', 'target' => '_blank')
);
相关问题