Show category image on article page

Discuss the development and implementation of Joomla! 1.0.x templates here.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
brythnoth
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri Jul 04, 2008 4:17 pm

Show category image on article page

Postby brythnoth » Fri Jul 04, 2008 4:25 pm

We need to show the category image on article page, found a work around by not showing the intro text and placeing the category image at the top of the main text but then the article title shows above the image.

I have seen a much older post on this same topic with no reply's, I hope someone has an answer as I've been working on this for a week solid and lost two nights kip!

Thanks in advance

Jeff

alexmcca
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Thu Mar 06, 2008 1:31 pm

Re: Show category image on article page

Postby alexmcca » Mon Jul 14, 2008 10:23 am

Hi there,
Sorry not to be posting a solution, but did you find any answer to this as I am trying to do exactly the same thing?

Thanks very much,
Alex.

User avatar
lamis
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Tue Jul 01, 2008 11:19 am

Re: Show category image on article page

Postby lamis » Wed Mar 25, 2009 11:37 am

there isnt an exact solution but what I did was ( work only for front end though -still you can find the right file to make it work on all articles-)
this is NOT the best solution but thats what I did at least
1- Created new folder in media manager called it categories
2- upload pictures to that folder and name them the same as categories with jpg extension
3- went to templates/mycurrentTemplate/html/com_content/frontpage/default_item.php
4- added this
<img src="images/categories/<?= $this->item->category ?>.jpg">

xabo
Joomla! Apprentice
Joomla! Apprentice
Posts: 13
Joined: Tue Jun 23, 2009 7:31 pm

Re: Show category image on article page

Postby xabo » Fri Aug 07, 2009 1:02 pm

hello, where in the php-file should i put in the code? Any specific line?

thanks

eriksmith200
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Fri Mar 05, 2010 1:30 pm
Contact:

Re: Show category image on article page

Postby eriksmith200 » Sat Mar 06, 2010 11:07 am

thanks for the tip!
www.iGetYouNews.com - Apple news from all over the web

lasangre
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sun May 30, 2010 5:46 am

Re: Show category image on article page

Postby lasangre » Sun May 30, 2010 5:50 am

Check this extension.

It allows you to display a specific category description and/or image on a module position for corresponding articles (it can be set to do it automatically).

http://extensions.joomla.org/extensions ... I7fQ%3D%3D

eckounlimited
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Sun Jul 25, 2010 5:01 pm

Re: Show category image on article page

Postby eckounlimited » Wed Jul 28, 2010 10:02 pm

Hi there... I got there by using this:

<img src="<?
$secid = $this->item->catid;
$this->section = & JTable::getInstance( 'category' );
$this->section->load( $secid );
$cparams = JComponentHelper::getParams ('com_media');
echo $cparams->get('image_path').'/'.$this->section->image;
?>">

Thanks for the module tip, I took a small code snipped from the module, looked through the joomla sources and finally found to this solution.

Lars

paskuale
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Oct 30, 2010 10:29 pm
Location: Bari
Contact:

Re: Show category image on article page

Postby paskuale » Sat May 07, 2011 7:38 am

hello guys how can I use this module within the new article form (front end) ?

thanks :eek:

alvarpoon
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Dec 07, 2011 10:07 am

Re: Show category image on article page

Postby alvarpoon » Wed Dec 07, 2011 10:09 am

in Joomla 1.6, to show the category image in an article, it should be

$secid = $this->item->catid;
$category = JCategories::getInstance('Content')->get($secid);
if ($category->getParams()->get('image')):?>
<img src="<?php echo $category->getParams()->get('image'); ?>"/>
<?php endif; ?>

TheBestLooser
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Dec 28, 2011 7:19 pm

Re: Show category image on article page

Postby TheBestLooser » Thu Dec 29, 2011 10:44 pm

Good evening,

there is there a code to display the image of the category in the article for joomla 1.7 / 2.5?

Thank you in advance

boredmind
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed May 04, 2011 2:08 pm

Re: Show category image on article page

Postby boredmind » Sun Jan 15, 2012 11:54 am

I would like the same in Joomla 1,7 does anyone know how to do this? thank you

mhdzn
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue May 26, 2009 8:11 pm

Re: Show category image on article page

Postby mhdzn » Thu Mar 01, 2012 7:12 pm

use this code.. it works in 2.5 and 1.7

Code: Select all

<a href="<?php echo $this->item->category->link; ?>"><img alt="<?php echo $this->item->category->name; ?>" src="media/k2/categories/<?php echo $this->item->category->image; ?>" border="0"/></a>

User avatar
modernmagic
Joomla! Explorer
Joomla! Explorer
Posts: 311
Joined: Mon Aug 10, 2009 3:58 pm
Location: Laguna Beach
Contact:

Re: Show category image on article page

Postby modernmagic » Thu Aug 28, 2014 3:35 am

Its great when you can use info from an old post and joomla version on the latest.

I used this to display the category image in an article:

Code: Select all

<div class="catimage">
   <?php
$secid = $this->item->catid;
$category = JCategories::getInstance('Content')->get($secid);
if ($category->getParams()->get('image')):?>
<img src="<?php echo $category->getParams()->get('image'); ?>"/>
<?php endif; ?>
</div>
Joomla! Website Designer http://www.modernmagic.com
Joomla! User Group Leadership Team http://www.ocjoomlausergroup.org/


Return to “Templates & CSS - 1.0.x”

Who is online

Users browsing this forum: No registered users and 3 guests