Page 1 of 1

Module to show categories ordered by date of creation

Posted: 23 Jan 2015, 16:08
by arsouille
Hi all,
i'd like to configure PhocaGallery Image Module to show five first categories, one image per categories, ordered by date of creation desc.
For example, i have :
- cat1 created 1/12/14
- cat2 created 2/12/14
- cat3 created 3/12/14
- cat4 created 10/12/14
- cat5 created 11/12/14
- cat6 created 12/12/14
- cat7 created 5/12/14
- cat8 created 6/12/14

the module while display
img1/cat6 -- img1/cat5 -- img1/cat4 -- img1/cat8 -- img1/cat7

Do i have to rewrite default.php and the request ? or is it possible via parameters ?

Re: Module to show categories ordered by date of creation

Posted: 23 Jan 2015, 19:22
by arsouille
I found a good but not the best request i think

Code: Select all

	$query = 'SELECT a.catid AS idcat, a.id AS idimage' 
			.'  FROM #__phocagallery AS a' 
			.'  WHERE a.catid IN (' 
      			.'	SELECT * FROM ('
          		.'		SELECT cat.id'
          		.'		FROM #__phocagallery_categories AS cat'
          		.'		WHERE cat.published = 1'
          		.'		ORDER BY cat.date DESC'
          		.'		LIMIT ' . $limit_start . ',' . $limit_count.')'
      			.'		AS temp)'
  			.'  AND a.published = 1' 
			.'  AND a.approved = 1'
			.'  GROUP BY a.catid';
Now let's go to CSS ...

Re: Module to show categories ordered by date of creation

Posted: 24 Jan 2015, 01:07
by Jan
Ok