简体   繁体   中英

joomla 2.5 view only image intro for any preview category

i have a problem with file override "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. 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/)

  2. Also, all the files from /components/com_content/views/category/tmpl need to be copied to your override, not just blog_item.php

If this doesn't solve it, it's definitely a sourcery

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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