在我正在处理的页面上,用户可以提交对博客文章的评论并显示他们的头像。虽然我可以检索所有关于评论作者的信息,但当我查询它的头像时,即使所有信息都在那里,查询总是返回空。
示例链接是: http: //www.natives.de/blogeintrag/items/59.html
模板代码如下:
<?php
$this->import('Database');
$authoravatar = $this->Database->prepare("SELECT xt_avatar FROM tl_user WHERE email=?")
->execute($this->email);
//var_dump($authoravatar);
?>
<div class="comment_default<?php echo $this->class; ?>" id="<?php echo $this->id; ?>">
<h3 class="info"><strong><?php if ($this->website): ?><a href="<?php echo $this->website; ?>" rel="nofollow" target="_blank"><?php endif; ?><?php echo $this->name; ?><?php if ($this->website): ?></a><?php endif; ?></strong> <time datetime="<?php echo $this->datetime; ?>" class="date"><?php echo $this->date; ?></time></h3>
<div class="authoravatar">
{{image::<?php echo $authoravatar->xt_avatar =='' ? 'tl_files/theme/image/notauser.png' : $authoravatar->xt_avatar; ?>?width=102&height=87&alt=<?php echo $this->name; ?>}}
</div>
<div class="comment">
<?php echo $this->comment; ?>
</div>
<?php if ($this->addReply): ?>
<div class="reply">
<p class="info"><?php echo $this->rby; ?> <?php echo $this->authorName; ?></p>
<div class="comment">
<?php echo $this->reply; ?>
</div>
</div>
<?php endif; ?>
</div>
我尝试了一切,但找不到如何返回头像。有吗?任何帮助都非常感谢!