How to add a description in the main (parent) category?

Phoca Gallery - image gallery extension
Alexander_photo
Phoca Member
Phoca Member
Posts: 18
Joined: 23 Feb 2010, 14:07
Contact:

How to add a description in the main (parent) category?

Post by Alexander_photo »

I use the menu "Phoca Gallery All categories"
How do I add on top of the list of all categories - a description?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49172
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: How to add a description in the main (parent) category?

Post by Jan »

Hi, there is no such option, so this needs to be customized in template of categories view or this can be solved through some module.

Jan
If you find Phoca extensions useful, please support the project
Alexander_photo
Phoca Member
Phoca Member
Posts: 18
Joined: 23 Feb 2010, 14:07
Contact:

Re: How to add a description in the main (parent) category?

Post by Alexander_photo »

Jan wrote:Hi, there is no such option, so this needs to be customized in template of categories view or this can be solved through some module.

Jan
Thank you for your reply!
Please add this option in the next version of the gallery!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49172
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: How to add a description in the main (parent) category?

Post by Jan »

Added into feature request list.

Jan
If you find Phoca extensions useful, please support the project
Alexander_photo
Phoca Member
Phoca Member
Posts: 18
Joined: 23 Feb 2010, 14:07
Contact:

Re: How to add a description in the main (parent) category?

Post by Alexander_photo »

Jan wrote:Added into feature request list.

Jan
Thank!!!
carriepr1
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 18 Feb 2009, 02:11

Re: How to add a description in the main (parent) category?

Post by carriepr1 »

I would like this too. I want to have a description on the main photo gallery page that is linked to the main menu. I believe that would be the categories view. It seems like most people would want this, so I hope this can get added soon.

In the meantime, can you tell us what code to add for this, and to which file?
imperialWicket
Phoca Enthusiast
Phoca Enthusiast
Posts: 78
Joined: 28 Feb 2010, 15:39

Re: How to add a description in the main (parent) category?

Post by imperialWicket »

This will be a handy update. In the meantime, if anyone needs this functionality you can hard-code a value in the "// Pagetitle" section of the /components/com_phocagallery/views/categories/tmpl/default.php file.

Something like the following would work:

Code: Select all

// Pagetitle
if ( $this->params->def( 'show_page_title', 1 ) ) {
	echo '<div class="componentheading'.$this->params->get( 'pageclass_sfx' ).'">'. $this->params->get('page_title').'</div>';
}

// DESCRIPTION UPDATE BEGIN
if ($this->params->get('page_title')=='MENU ITEM'){
  echo '<div class="contentdescription">My description for the parent category</div>';
}
// DESCRIPTION UPDATE END
The page_title value check probably is not necessary, but it gives you the opportunity to have multiple menu items that may or may not include the description. You will need to choose an appropriate div class or customize some CSS if the contentdescription styling is not optimal for your page.

Hope this helps.
Alexander_photo
Phoca Member
Phoca Member
Posts: 18
Joined: 23 Feb 2010, 14:07
Contact:

Re: How to add a description in the main (parent) category?

Post by Alexander_photo »

imperialWicket

Please show me an example of all the modified files to add a description in the parent category

What about multilingual sites? I need to show two different descriptions, depending on the choice of language.
imperialWicket
Phoca Enthusiast
Phoca Enthusiast
Posts: 78
Joined: 28 Feb 2010, 15:39

Re: How to add a description in the main (parent) category?

Post by imperialWicket »

This post is not a proper improvement or feature update, rather it is a hack to manually put a hardcoded text string onto the Category page below the title.

The only necessary modification to any files is to add the three lines of code listed above directly beneath the page_title echo.

However, you highlight a good update, alternate languages should always be supported when practical, and in order to do so, the following changes are needed:

Instead of hardcoding the text string in the /components/com_phocagallery/views/categories/tmpl/default.php file, use a String reference value that we can add to your Phoca Gallery language files:

Code: Select all

// Pagetitle
if ( $this->params->def( 'show_page_title', 1 ) ) {
   echo '<div class="componentheading'.$this->params->get( 'pageclass_sfx' ).'">'. $this->params->get('page_title').'</div>';
}

// DESCRIPTION UPDATE BEGIN
if ($this->params->get('page_title')=='MENU ITEM'){
  echo '<div class="contentdescription">'.JText::_('PHOCAGALLERY_CUSTOM_DESCRIPTION_VALUE') .'/div>';
}
// DESCRIPTION UPDATE END
Now, at the bottom of the language file (add to each language you support) /language/en-GB/en-GB.com_phocagallery.ini add:

Code: Select all

PHOCAGALLERY_CUSTOM_DESCRIPTION_VALUE=The description text you want to display, in the appropriate language for the file.
This requires the update to the mentioned default.php tmpl file, telling the template to display your value, and then you must add the value to each language file that will be available.

I haven't encountered the need to support multilingual Phoca Gallery installations, but I believe this will work. Good luck.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49172
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: How to add a description in the main (parent) category?

Post by Jan »

I haven't encountered the need to support multilingual Phoca Gallery installations, but I believe this will work. Good luck.
Hi, thank you for this guide, yes this will work. If the string will be pasted to every used Phoca Gallery language string, then all will be OK.
If you find Phoca extensions useful, please support the project
Post Reply