Page 1 of 1
Re: Reverse select way to show categories
Posted: 08 Sep 2010, 00:10
by Jan
Hi, this is planned, for now only hiding different categories can be set
Jan
Re: Reverse select way to show categories
Posted: 20 Sep 2010, 15:44
by gerardq
Hello Jan,
I am looking for this option too. Do you have an idea when it will be released? At the moment I have on every group page included: '..hidecategories=1,2,3,4,5,..etc..100' and then remove the albums I want to see from that string. Not very elegant
Re: Reverse select way to show categories
Posted: 20 Sep 2010, 17:57
by Jan
Hi, still no idea when I will be able to implement it
Jan
Re: Reverse select way to show categories
Posted: 21 Sep 2010, 22:53
by gerardq
Hi Jan,
I realized I really needed yet another option: I am setting up a site for a primary school and all the classes are Joomla categories. They all have photo albums and I want to show previews of their own albums on each class page. So I now created empty Phoca top level categories for each class and uploaded all albums under the corresponding Phoca category.
I adhanced your code just a bit so I can specify a 'parentcategoryid'. The class pages now show only their own photo albums.
Are you interested in this tiny enhancement or shall I publish it on this forum?
Re: Reverse select way to show categories
Posted: 22 Sep 2010, 14:40
by Jan
Hi, just publish it here so other users can see it (if they are interested in such solution). For now I am still not able to look at it
but there are some other users which can help
Jan
Re: Reverse select way to show categories
Posted: 25 Sep 2010, 21:57
by gerardq
When view=categories, to show only categories with a certain parentid, edit the file /plugin/content/phocagallery.php like this (based on plg_content_phocagallery_2.7.2, in bold the code that has to be added ):
...
$catid = 0;
$parentcatid = 0;
...
...
else if($values[0]=='categoryid') {$catid = $values[1];}
else if($values[0]=='parentcategoryid') {$parentcatid = $values[1];}
...
...
$uniqueCatSql = '';
if ($catid > 0) {
$uniqueCatSql = ' AND cc.id = '. $catid .'';
}
$parentCatSql = '';
if ($parentcatid > 0) {
$parentCatSql = ' AND cc.parent_id = '. $parentcatid .'';
}
...
...
$queryc = 'SELECT cc.*, a.catid, COUNT(a.id) AS numlinks,'
...
. $uniqueCatSql
. $parentCatSql
. ' GROUP BY cc.id'
. ' ORDER BY cc.ordering';
...
...
$output .= '<tr>'
//to show alias and description beside the category...
if ($display_description == 1) {
.'<td style="width:500px"><b>'.$category->alias.' </b>' .$category->description.'</td>';
}
.'<td align="center" valign="middle" style="'.$imageBg.'"><a href="'.$category->link.'">';
usage: {phocagallery view=categories|parentcategoryid=4|displaydescription=1|}
Re: Reverse select way to show categories
Posted: 26 Sep 2010, 12:31
by Jan
Hi, thank you for this guide. Marked as improvement.
Jan
Re: Reverse select way to show categories
Posted: 16 May 2011, 14:08
by pix
benoix wrote:Hello,
I use phoca gallery Plugin in my article to show link into my gallery.
I can choose which categories I hide but I would like to do opposite. That means I would like choose which categories I want to SHOW. Because, in example, when I show a link into one categories (I hide all the others) in an article that is ok but after if I add a new categories it will be show in my article ! It will not hide.
Wich file I have to modify to do this ?
Thank
Ben
for showing selected categories you should add only 4 lines
check the argument
Code: Select all
else if($values[0]=='showcategories') {$show_categories = $values[1];}
create SQL part - just add:
$showCat = trim( $show_categories );
$showCatSql .= ' AND cc.id IN ('. $showCat .') ';
Code: Select all
//--------------------------
// DISPLAYING OF CATEGORIES (link doesn't work if there is no menu link)
//--------------------------
$hideCat = trim( $hide_categories );
$hideCatArray = explode( ',', $hide_categories );
$hideCatSql = '';
if (is_array($hideCatArray)) {
foreach ($hideCatArray as $value) {
$hideCatSql .= ' AND cc.id != '. (int) trim($value) .' ';
}
}
$showCat = trim( $show_categories );
$showCatSql .= ' AND cc.id IN ('. $showCat .') ';
and add it to sql query
Code: Select all
if ($view == 'categories') {
//CATEGORIES
$queryc = 'SELECT cc.*, a.catid, COUNT(a.id) AS numlinks,'
. ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(\':\', cc.id, cc.alias) ELSE cc.id END as slug'
. ' FROM #__phocagallery_categories AS cc'
. ' LEFT JOIN #__phocagallery AS a ON a.catid = cc.id'
. ' WHERE a.published = 1'
. ' AND cc.published = 1'
. ' AND cc.approved = 1'
. ' AND a.approved = 1'
. $hideCatSql
. $showCatSql
. $uniqueCatSql
. ' GROUP BY cc.id'
. ' ORDER BY cc.ordering';
I just needed this option, and I was suprised that there is no code for that. Think it should be added to released plugin.
regards, Pix
Re: Reverse select way to show categories
Posted: 17 May 2011, 12:55
by Jan
Hi, thank you for the guide.
Jan