简体   繁体   English

joomla 2.5仅查看任何预览类别的图像简介

[英]joomla 2.5 view only image intro for any preview category

i have a problem with file override "blog_item.php". 我对文件覆盖“ blog_item.php”有疑问。 I want to see only the first image in each category without the introductory text. 我只想查看每个类别中的第一张图片,而没有介绍性文字。 how can I do? 我能怎么做? I wrote this code: 我写了这段代码:

<?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; ?>

I think Joomla is not using your file. 我认为Joomla没有使用您的文件。 You can verify this by adding something very visible to the file, such as 您可以通过添加文件中非常明显的内容来验证这一点,例如

<h1>YOU'RE HERE</h1>

if you don't see the new text after clearing the cache continue reading. 如果清除缓存后看不到新文本,请继续阅读。

  1. Make sure you have placed blog_item in the right folder (templates/your_template/html/com_content/category/) 确保已将blog_item放置在正确的文件夹中(templates / your_template / html / com_content / category /)

  2. Also, all the files from /components/com_content/views/category/tmpl need to be copied to your override, not just blog_item.php 另外,/ components / com_content / views / category / tmpl中的所有文件都需要复制到您的替代文件中,而不仅仅是blog_item.php

If this doesn't solve it, it's definitely a sourcery 如果这不能解决问题,那肯定是一个来源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM