Category description at section page

Phoca Download - download manager
guigue
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 28 Apr 2010, 14:49

Category description at section page

Post 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!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Category description at section page

Post by Jan »

Hi, you should check if the description (which? - file, category, main) was loaded from database by model
If you find Phoca extensions useful, please support the project
guigue
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 28 Apr 2010, 14:49

Re: Category description at section page

Post 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.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Category description at section page

Post by Jan »

Hi, I think you need to see some guide on Joomla!.org or see the other code, where other items are loaded :-(
If you find Phoca extensions useful, please support the project
jbourque
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 21 Jul 2010, 01:52

Re: Category description at section page

Post 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
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Category description at section page

Post 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
If you find Phoca extensions useful, please support the project
jonusc
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 21 Jul 2011, 11:30
Contact:

Re: Category description at section page

Post 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 :)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49144
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Category description at section page

Post by Jan »

Hi, added into feature request list.

Jan
If you find Phoca extensions useful, please support the project
Post Reply