Page 1 of 1

Limit number of displayed categories

Posted: 05 Jul 2011, 09:58
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.

Re: Limit number of displayed categories

Posted: 07 Jul 2011, 23:38
by Jan
Hi, then you need to customize it in the code :-(

Jan

Re: Limit number of displayed categories

Posted: 12 Jul 2011, 10:41
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

Re: Limit number of displayed categories

Posted: 12 Jul 2011, 17:19
by Jan
Hi, thank you for the guide, added to feature request list.

Jan