Page 2 of 2

Re: categories

Posted: 29 Jul 2009, 14:29
by Jan
Hi, thank you for this solution, I will take a look at it so I can add it to some of next version

Jan

Re: categories

Posted: 11 Feb 2010, 17:16
by brown12321
Anyone have a solution to do the same thing in the category.php?

Re: categories

Posted: 11 Feb 2010, 17:40
by brown12321
I have found the remainder of the solution

File: components\com_phocagallery\views\categories\tmpl\default_categories.php

Code: Select all

<?php
defined('_JEXEC') or die('Restricted access');

if(!empty($this->itemscv)) {
	$columns 			= (int)$this->tmpl['categoriescolumnscv'];
	$countCategories 	= count($this->itemscv);
	$begin				= array();
	$end				= array();
	$begin[0]			= 0;// first
	$begin[1]			= ceil ($columns);
	$end[0]				= $begin[1] -1;

	for ( $j = 2; $j < $columns; $j++ ) {
		$begin[$j]	= ceil($columns * $j);
		$end[$j-1]	= $begin[$j] - 1;
	}
	$end[$j-1]		= $countCategories - 1;// last
	$endFloat		= $countCategories - 1;
} else {
	$countCategories 	= 0;
}
// -------------------
// TABLE LAYOUT
// -------------------
if ($this->tmpl['displayimagecategoriescv'] == 1) {
	for ($i = 0; $i < $countCategories; $i++) {

		// Change the thumbnail for Category View
		// We are in Category View but need Categories View Settings
		if (isset($this->itemscv[$i]->extpic) && $this->itemscv[$i]->extpic) {

			$categoryCVSize = PhocaGalleryImageFront::getSizeString($this->tmpl['imagetypecv']);
			if ($categoryCVSize == 'm') {
				$picCorW = $this->tmpl['picasa_correct_width_m'];
				$picCorH = $this->tmpl['picasa_correct_height_m'];
			} else {
				$picCorW = $this->tmpl['picasa_correct_width_s'];
				$picCorH = $this->tmpl['picasa_correct_height_s'];
			}
			$imageThumbnail = PhocaGalleryImageFront::displayCategoriesCVExtImgOrFolder($this->itemscv[$i]->extm, $this->itemscv[$i]->exts, $this->itemscv[$i]->linkthumbnailpath, (int)$this->tmpl['imagetypecv']);
		} else {
			$imageThumbnail = PhocaGalleryImageFront::displayCategoriesCVImageOrFolder($this->itemscv[$i]->linkthumbnailpath, (int)$this->tmpl['imagetypecv']);
		}
		// - - - - - - - - - - - - - - -

		if ( $columns == 1 ) {
			echo '<table>';
		} else {
			$float = 0;
			foreach ($begin as $k => $v)
			{
				if ($i == $v) {
					$float = 1;
				}
			}
			if ($float == 1) {
				echo '<div style="position:relative;float:left;margin:0px;"><table><tr>';
			}
		}

		echo '<td align="center" valign="top" style="'.$this->tmpl['imagebg'].';text-align:center;"><a href="'.$this->itemscv[$i]->link.'">'.JHTML::_( 'image.site', $this->itemscv[$i]->linkthumbnailpath, '', '', '', $this->itemscv[$i]->title, 'style="border:0"' ).'<br /></a>'.'<a href="'.$this->itemscv[$i]->link.'" class="category'.$this->params->get( 'pageclass_sfx' ).'">'.$this->itemscv[$i]->title.'</a>&nbsp;';

		if ($this->itemscv[$i]->numlinks > 0) {echo '<span class="small">('.$this->itemscv[$i]->numlinks.')</span>';}

		echo '</td>';


		if ( $columns == 1 ) {
			echo '</tr></table>';
		} else {
			if ($i == $endFloat) {
				echo '</tr></table></div><div style="clear:both"></div>';
			} else {
				$float = 0;
				foreach ($end as $k => $v)
				{
					if ($i == $v) {
						$float = 1;
					}
				}
				if ($float == 1) {
					echo '</tr></table></div>';
				}
			}
		}
	}
}
// -------------------
// UL LAYOUT
// -------------------
else {
	for ($i = 0; $i < $countCategories; $i++) {

		if ( $columns == 1 ) {
			echo '<ul>';
		} else {
			$float = 0;
			foreach ($begin as $k => $v)
			{
				if ($i == $v) {
					$float = 1;
				}
			}
			if ($float == 1) {
				echo '<div style="position:relative;float:left;margin:0px"><ul>';
			}
		}

		echo '<li><a href="'.$this->itemscv[$i]->link.'" class="category'.$this->params->get( 'pageclass_sfx' ).'">'.$this->itemscv[$i]->title.'</a>&nbsp;';

		if ($this->itemscv[$i]->numlinks > 0) {echo '<span class="small">('.$this->itemscv[$i]->numlinks.')</span>';}

		echo '</li>';

		if ( $columns == 1 ) {
			echo '</ul>';
		} else {
			if ($i == $endFloat) {
				echo '</ul></div><div style="clear:both"></div>';
			} else {
				$float = 0;
				foreach ($end as $k => $v)
				{
					if ($i == $v) {
						$float = 1;
					}
				}
				if ($float == 1) {
					echo '</ul></div>';
				}
			}
		}
	}
}
?>
<div class="phoca-hr"></div>

Re: categories

Posted: 13 Feb 2010, 19:28
by Jan
Hi, you can display categories in caetegory view in a row - (if detailed displaying is enabled) see parameters:
https://www.phoca.cz/documents/2-phoca-g ... -menu-item

Display Categories Style: Categories, Images and detail information (Float)

Jan