The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.



Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Fri Jul 04, 2008 4:25 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Jul 04, 2008 4:17 pm
Posts: 5
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


Top
 Profile  
 
PostPosted: Mon Jul 14, 2008 10:23 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Mar 06, 2008 1:31 pm
Posts: 17
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.


Top
 Profile  
 
PostPosted: Wed Mar 25, 2009 11:37 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Jul 01, 2008 11:19 am
Posts: 11
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">


Top
 Profile  
 
PostPosted: Fri Aug 07, 2009 1:02 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Jun 23, 2009 7:31 pm
Posts: 13
hello, where in the php-file should i put in the code? Any specific line?

thanks


Top
 Profile  
 
PostPosted: Sat Mar 06, 2010 11:07 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Mar 05, 2010 1:30 pm
Posts: 5
thanks for the tip!

_________________
www.iGetYouNews.com - Apple news from all over the web


Top
 Profile  
 
PostPosted: Sun May 30, 2010 5:50 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sun May 30, 2010 5:46 am
Posts: 2
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


Top
 Profile  
 
PostPosted: Wed Jul 28, 2010 10:02 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sun Jul 25, 2010 5:01 pm
Posts: 3
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


Top
 Profile  
 
PostPosted: Sat May 07, 2011 7:38 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Oct 30, 2010 10:29 pm
Posts: 5
Location: Bari
hello guys how can I use this module within the new article form (front end) ?

thanks :eek:


Top
 Profile  
 
PostPosted: Wed Dec 07, 2011 10:09 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Dec 07, 2011 10:07 am
Posts: 1
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; ?>


Top
 Profile  
 
PostPosted: Thu Dec 29, 2011 10:44 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Dec 28, 2011 7:19 pm
Posts: 1
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


Top
 Profile  
 
PostPosted: Sun Jan 15, 2012 11:54 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed May 04, 2011 2:08 pm
Posts: 1
I would like the same in Joomla 1,7 does anyone know how to do this? thank you


Top
 Profile  
 
PostPosted: Thu Mar 01, 2012 7:12 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue May 26, 2009 8:11 pm
Posts: 2
use this code.. it works in 2.5 and 1.7
Code:
<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>


Top
 Profile  
 
PostPosted: Thu Aug 28, 2014 3:35 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Mon Aug 10, 2009 3:58 pm
Posts: 238
Location: Laguna Beach
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:
<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/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 



Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group