0
votes

I would like to change the leading articles html structure for the blog category page in Joomla 2.5.

It has to be like this

<dl>
    <dt><a href="#">intro-image</a></dt>
    <dd>
        <h3>article-title</h3>
        <var>published-date</var>
        intro-text
    </dd>
</dl>

I copied blog.php file into my-template/html/com-content/category/ and modified it

<?php if (!empty($this->lead_items)) : ?>
<?php foreach ($this->lead_items as &$item) : ?>
    <dl>
    <dt></dt>
    <dd>
        <?php
            $this->item = &$item;
            echo $this->item->introtext;
        ?>
    </dd>
    <?php
        $leadingcount++;
    ?>
    </dl>
<?php endforeach; ?>

But as you see I only managed to show the intro text. How can intro image, article title and published date be displayed on their places? Are there more files, which have to be modified?

I appreciate any help. Thank you.

1

1 Answers

1
votes

Half way there. Here is the code but I'm not sure what you mean by the intro image. Is it part of the article? Please explain and I might be able to get it working fully:

<?php foreach ($this->lead_items as &$item) : ?>
    <dl>
    <dt>
       <?php 
         $params = JComponentHelper::getParams( 'com_content' );
         $this->item = &$item;
         $images = json_decode($item->images);
             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 '<a href="#"><img'.$class.$title.' src="'.htmlspecialchars($images->image_intro).'" alt="'.htmlspecialchars($images->image_intro_alt).'" /></a>';
              }
       ?>   
    </dt>
    <dd>
        <h3><?php echo $this->item->title; ?></h3>
        <var><?php echo $this->item->publish_up; ?></var>
        <?php echo $this->item->introtext; ?>
    </dd>
      <?php $leadingcount++; ?>
    </dl>
<?php endforeach; ?>