Page 1 of 1

Insert some text before subcategory name

Posted: 23 Aug 2017, 15:46
by michy5
Hi,
I'm trying to customize Phoca Download and I have a question (as topic subkect): I would like to insert some text before SUBCATEGORY NAME (obviously when a subcategory is present).
I succeded in doing it for PARENT CATEGORY

Code: Select all

      $pdTitle = 'Categoria principale: <a href="'. JRoute::_(PhocaDownloadRoute::getCategoryRoute($value->id, $value->alias)).'">'.  $value->title.'</a>';
but i do not succed in doing the same for SUBCATEGORY.
I've try to edit localsite\components\com_phocadownload\views\categories\tmpl\default.php in the following but I can't do what i want:

Code: Select all

			if ($this->t['displaynumdocsecsheader'] == 1) {
				$numDocAll = (int)$numDoc + (int)$value->numdoc;
				//$numDoc ... only files in subcategories
				//$value->numdoc ... only files in the main category
				//$numDocAll ... files in category and in subcategories
				$pdTitle .= ' <small>('.$numSubcat.'/' . $numDocAll .')</small>';
			}
			
			
			$pdDesc = '';
			$pdSubcategories = '';
			if ($this->t ['displaymaincatdesc']	 == 1) {
				$pdDesc .= $value->description;
			} else {
				if ($catOutput != '') {
					$pdSubcategories .= $catOutput ;
				} else {
					$pdSubcategories .= '<div class="pd-no-subcat">'.JText::_('COM_PHOCADOWNLOAD_NO_SUBCATEGORIES').'</div>';
				}
			}
			
			$pdClear = '';
			if ($i%3==0) {
				$pdClear .= '<div class="pd-cb"></div>';
			}
			$i++;

Any suggestion?

Thanks

Re: Insert some text before subcategory name

Posted: 23 Aug 2017, 18:15
by michy5
Hi,
I casually found the solution. The fact is that I was editing the wrong lines of code!
I write here the solution so that if someone looks for or has the same issue, they can easly find the solution:
The code to edit is more or less at the line 38 of yoursite\components\com_phocadownload\views\categories\tmpl\default.php.

My code is:

Code: Select all

$catOutput 	.= 'Sottocategoria: <a href="'. JRoute::_(PhocaDownloadRoute::getCategoryRoute($valueCat->id, $valueCat->alias))
where "Sottocategoria:" is the text i wanted to insert before sub-category name

I hope it helps.
Bye

Re: Insert some text before subcategory name

Posted: 24 Aug 2017, 15:35
by Jan
Ok, thank you for the info.

Jan