的Joomla 2.5视图仅适用于任何种类的预览
问题描述:
图像介绍我有文件覆盖“blog_item.php”的问题。 我只想看到没有介绍性文字的每个类别中的第一幅图像。我能怎么做? 我写了这个代码:的Joomla 2.5视图仅适用于任何种类的预览
<?php
if (isset($images->image_intro) and !empty($images->image_intro))
{
$imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro;
$class = (htmlspecialchars($imgfloat) != 'none') ? ' class="size-auto align-'.htmlspecialchars($imgfloat).'"' : ' class="size-auto"';
$title = ($images->image_intro_caption) ? ' title="'.htmlspecialchars($images->image_intro_caption).'"' : '';
echo '<img'.$class.$title.' src="'.htmlspecialchars($images->image_intro).'" alt="'.htmlspecialchars($images->image_intro_alt).'" />';
}?>
<?php echo $this->$images->image_intro; ?>
答
我认为Joomla是不使用你的文件。您可以通过添加一些东西到文件非常明显,如
<h1>YOU'RE HERE</h1>
验证这一点,如果你没有看到清除缓存继续读书后的新文本。
确保您已放置blog_item在正确的文件夹(模板/ your_template中/ HTML/com_content /分类/)
此外,从所有的文件/组件/ com_content /视图/分类/ TMPL需要被复制到你的重写,不只是blog_item.php
如果不解决这个问题,它绝对是一个的Sourcery
你看到了什么?有没有错误?我注意到,在代码中无处不存在'$ this-> images - > ...',只有在最后一个语句中。 –
或者你可以尝试var_dump($ this-> images)来查看发生了什么?还有一件事,我在最后的声明中看到这是错误的。没有$的图像 – Nathanphan