aliens wrote:
Okay this is something that I've been looking for quite a while, and couldn't find good solutions for 1.5.
This simply replaces the intro text of an article listed in Category/Blog with the first image found in the intro text (unfortunately, the image will be displayed as is, without resizing/thumbnailing). Also, the image is linked to the article.
Create a template override for
"components/com_content/views/category/tmpl/blog_item.php" in
"templates/<template name>/html/com_content/category/blog_item.php".
Replace this line (usually found on line 116 in the 1.5.1 release):
Code:
<?php echo $this->item->text; ?>
With:
Code:
<?php preg_match('/<img (.*?)>/', $this->item->text, $match); ?><a href="<?php echo $this->item->readmore_link; ?>"><?php echo $match[0]; ?></a>
Again, this only displays the picture exactly how it is displayed in the article. No thumbnailing/modifications are made other that it links to it's article.
I am trying to implement a similar feature in
default - category list layout (i.e. in opposition to Blog mode mentioned in this post). I would like the first image (thumbnail) from each article to appear next to its title, in an extra column of the table that contains/lists those articles.
I copied the segment of code that you suggested in
"templates/<template_name>/html/com_content/category/default_items.php", but it seems that the statement "$this->item->text" does not work/return anything.
Can anyone please give me a hint? Although I am familiar with PHP, this is the first time I try to modify Joomla PHP code, and cannot really understand how it works.
Thanks a lot