我有这个:
<?php echo $this->htmlLink($this->viewer()->getHref(), $this->itemPhoto($this->viewer(), 'thumb.icon')); ?>
生成HTML代码,如:
<a href="http://www.domain.com/john">
<img src="http://www.domain.com/thumb_0205.jpg" alt="" class="thumb_icon item_photo_user thumb_icon">
</a>
现在,我要做的是添加:
<?php echo $this->viewer()->getTitle(); ?> //This will generate the member's name, like "John Doe"
到上面的代码,生成一个HTML代码,如:
<a href="http://www.domain.com/john">
<img src="http://www.domain.com/thumb_0205.jpg" alt="" class="thumb_icon item_photo_user thumb_icon">
<span>John Doe</span>
</a>
无论如何我能做到吗?
由于
答案 0 :(得分:2)
这应该有效:
<?php echo $this->htmlLink(
$this->viewer()->getHref(),
$this->itemPhoto($this->viewer(), 'thumb.icon') . '<span>' . $this->viewer()->getTitle() . '</span>'
); ?>
答案 1 :(得分:2)
猜猜,这应该有效:
<?php echo $this->htmlLink($this->viewer()->getHref(), $this->itemPhoto($this->viewer(), 'thumb.icon').'<span>'. $this->viewer()->getTitle().'</span>'); ?>
只需将额外的字符串附加到htmlLink的第二个参数。
HtmlLink($href, $text, $title = "", array $attribs = array());