Add description in Categories View?

Phoca Download - download manager
User avatar
Benno
Phoca Hero
Phoca Hero
Posts: 9119
Joined: 04 Dec 2008, 11:58
Location: Germany
Contact:

Re: Add description in Categories View?

Post by Benno »

Hi,
Phoca Gallery Version 4.3.1
And why you are posting in Phoca Download Forum? :idea:
Backend --> Components --> Phoca Gallery --> Control Panel --> Options --> Categories View Settings --> Categories View Description

Kind regards,
Benno
xswer
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 25 Jul 2016, 21:18

Re: Add description in Categories View?

Post by xswer »

I'm sorry, my mistake.

I would show description for Category View, not Categories View in general.

For witch category (and sub-category) i would show the descripction under the title.

I added in Line 161 in the file components/com_phocagallery/views/category/tmpl/default_images.php

Code: Select all

// Category Description
				if (isset($this->category->description) && $this->category->description != '' ) {
					echo '<div class="pg-cv-desc">'. JHTML::_('content.prepare', $this->category->description) .'</div>'. "\n";
				}
Thats the result:
http://zagips.nitadesign.ch/referenzen.html

It take description from current category and not from the sub-category.

Thanks for the help
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Add description in Categories View?

Post by Jan »

Hi, in category view, this is the description of the category, you are currently located. To see description of subcategories listed on the site, you need to load if from each subcategory item, which you can find in foreach.

Depends if you display categories in boxes like images have or above the images. If e.g. inside image boxes:
components\com_phocagallery\views\category\view.html.php - cca 730

there you need to assign the loaded description from database to some variable and in output:

components\com_phocagallery\views\category\tmpl\default_images.php

you need to print it

Jan
If you find Phoca extensions useful, please support the project
xswer
Phoca Newbie
Phoca Newbie
Posts: 8
Joined: 25 Jul 2016, 21:18

Re: Add description in Categories View?

Post by xswer »

Hi Jan

Thanks you for your interessant input.

Also I copied this Code from components\com_phocagallery\views\category\view.html.php - cca 730
and i added in: components\com_phocagallery\views\category\tmpl\default_images.php

Code: Select all

			
		// ----------------------------------------
		// SUB FOLDERS(1) STANDARD
		// ----------------------------------------
		// Display subcategories on every page
		if ($display_subcat_page == 1) {

			$subCategory = $this->get('subcategory'); 
			$totalSubCat = count($subCategory);
			
			if ((int)$this->tagId > 0) {$subCategory = array();}// No subcategories for tag searching

			if (!empty($subCategory)) {
				$this->items[$iS] = &$subCategory;
		  
				for($iSub = 0; $iSub < $totalSubCat; $iSub++) {
					etc etc..............
And I added this code for taking subCategory description:

Code: Select all

// subCategory Description
			if ($cv->type == 1) {
				if ($cv->display_name== 1 || $cv->display_name == 2) {
					
					
					if ($this->tmpl['bootstrap_icons'] == 0) {
						$cls 	= 'class="pg-box-subfolder"';
						$icon	= '';
					} else {
						$cls 	= 'class="pg-box-subfolder"';
						$icon	= PhocaGalleryRenderFront::renderIcon($cv->iconcls, '', ''). ' ';
					}
					echo '<div '.$cls.'>'.$icon. PhocaGalleryText::wordDelete($cv->subCategory, $this->tmpl['char_cat_length_name'], '...').'</div>';
				}
			}
			
Now I it display the <div class="pg-box-subfolder"> in Firebug but It don't find the correct attribute for "subcategory description"
http://zagips.nitadesign.ch/referenzen.html

It is really possibly to display the correct description from subcategories under the image title?
Thanks you for the help.

Greetings
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Add description in Categories View?

Post by Jan »

Hi, every categry has description - such description is display in category view at the bottom for each category.

If you want to display the description for each subcategory in category view - the description needs to be loaded from the database.

For now only main description for the current category is loaded so you need to load it for listed subcategories too (as default it is not loaded because if it is not displayed as default because of performance issues it is not even loaded)

So
1) in category view when subcategories are loaded - only their ID, title, alias are loaded, so this needs to be change (probably in model) to load the describpion too
2) then in php html output "deafault. ..." the value should be displayed with help of html

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