Page 1 of 1
Category description at section page
Posted: 28 Apr 2010, 14:55
by guigue
Hi, I called a section so all the categories into this section are displayed with the number of documents, but i want too to show in each category of the list the category description.
I tried adding to the section default.php something like
Code: Select all
echo ''.$valueCat->category[0]->description.'';
just bellow:
Code: Select all
echo '<a href="'. JRoute::_(PhocaDownloadHelperRoute::getCategoryRoute($valueCat->id, $valueCat->alias, $this->section[0]->id)).'">'. $valueCat->title.'</a>';
echo ' <small>('.$valueCat->numdoc.')</small></p>' . "\n";
but nothing happens, and is normal because I'm novice on this things.
Can I do something?
Thanks!
Re: Category description at section page
Posted: 29 Apr 2010, 22:37
by Jan
Hi, you should check if the description (which? - file, category, main) was loaded from database by model
Re: Category description at section page
Posted: 03 May 2010, 09:52
by guigue
Hi, thanks, but, how can I load the description from the database??
Sorry, I'm a starter in Joomla. My experience is with wordpress only, thanks.
Re: Category description at section page
Posted: 12 May 2010, 13:40
by Jan
Hi, I think you need to see some guide on Joomla!.org or see the other code, where other items are loaded

Re: Category description at section page
Posted: 21 Jul 2010, 01:55
by jbourque
Jan
What is the solution for this? I also want to add the category description to the right of the category title in the section layout.
I added the following to section default.php
$catOutput .=' <h2>('.$valueCat->description .')</h2>';
All I'm getting is () it's not pulling the description
Thanks,
Joe
Re: Category description at section page
Posted: 26 Jul 2010, 16:24
by Jan
Hi, sorry I don't understand:
What is the solution for this? I also want to add the category description to the right of the category title in the section layout.
I didn't any such modification so no experiences there.
Jan
Re: Category description at section page
Posted: 21 Jul 2011, 12:30
by jonusc
Hi guys,
I registered here just to share my solution. I hope the creator can create a new parameter for this in the next version, it seems like a very essential option to me. To be clear, you can see the changes in action right here -
http://jonus.me/software/
Note that the description is taken from "Meta Description" and not the actual "Description" field (i.e. from the WYSIWYG editor) - this would be best practice, as the Description is probably very long and could include images - the Meta Description is ideally a one-sentence description in a nutshell. Anyway, here is the code changes:
1)
File at /components/com_phocadownload/models/section.php
Replace this line (at 67 in my version)...
Code: Select all
$query = " SELECT cc.id, cc.title, cc.alias, cc.access, cc.accessuserid, COUNT(c.id) AS numdoc"
...with this data...
Code: Select all
$query = " SELECT cc.id, cc.title, cc.alias, cc.metadesc, cc.access, cc.accessuserid, COUNT(c.id) AS numdoc"
2)
File at /components/com_phocadownload/views/section/tmpl/default.php
Replace these lines (starting at 44 in my version)...
Code: Select all
echo '<a href="'. JRoute::_(PhocaDownloadHelperRoute::getCategoryRoute($valueCat->id, $valueCat->alias, $this->section[0]->id)).'">'. $valueCat->title.'</a>';
echo ' <small>('.$valueCat->numdoc.')</small></p>' . "\n";
...with this data...
Code: Select all
echo '<a style="font-size: 1.4em;"href="'. JRoute::_(PhocaDownloadHelperRoute::getCategoryRoute($valueCat->id, $valueCat->alias, $this->section[0]->id)).'">'. $valueCat->title.'</a>';
echo ' <small>('.$valueCat->numdoc.')</small>' . "</p>";
echo '<p>'.$valueCat->metadesc.'</p>' . "<br/><br/>";
...note that I made the font-size of the title link a little bigger, just my preference; and also added a couple of new-lines after the metadesc. Customize to your own needs if you desire.
Please add this option in a future version

I already have enough custom code-hacks to worry about whenever I update my extensions! Thanks for the great Phoca Download

Re: Category description at section page
Posted: 21 Jul 2011, 22:12
by Jan
Hi, added into feature request list.
Jan