Limit number of displayed categories

Phoca Gallery modules - modules for Phoca Gallery extension
cellardoor_ncx
Phoca Member
Phoca Member
Posts: 20
Joined: 18 May 2011, 16:15

Limit number of displayed categories

Post by cellardoor_ncx »

Hi. I see there is an option to limit displayed categories with excluding IDs of categories. I'd like to limit it to display only newest 5 categories. Is there an option like this ? Thanks.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Limit number of displayed categories

Post by Jan »

Hi, then you need to customize it in the code :-(

Jan
If you find Phoca extensions useful, please support the project
cellardoor_ncx
Phoca Member
Phoca Member
Posts: 20
Joined: 18 May 2011, 16:15

Re: Limit number of displayed categories

Post by cellardoor_ncx »

Ok I managed to do this, so for those seeking for this option :
1. Edit modules/mod_phocagallery_menu/mod_phocagallery_menu.php
2. In function phocaGalleryMenuModuleMenuDown line 101 edit $query :

I wanted this module to show only 5 newest galleries, most newest on top (descending) so the SQL code would look like :

Code: Select all

$query = 'SELECT cc.title AS text, cc.id AS id, cc.parent_id as parentid, cc.alias as alias, cc.access as access, cc.accessuserid as accessuserid'
		. ' FROM #__phocagallery_categories AS cc'
		. ' WHERE cc.published = 1'
		. ' AND cc.approved = 1'
		. ' AND cc.parent_id = '.$category_id
		. $hideCatSql
		. $hideCatAccessSql
		. ' ORDER BY cc.date DESC '
                . 'LIMIT 5';
Jan, should you plan a new release of this module, consider adding couple of options like sorting categories and limiting. Thanks
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Limit number of displayed categories

Post by Jan »

Hi, thank you for the guide, added to feature request list.

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