Last active
August 29, 2015 14:04
-
-
Save betweenbrain/e07c94110d5b843ad0bc to your computer and use it in GitHub Desktop.
Force group / sort Joomla items by category
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$db = JFactory::getDbo(); | |
$query = $db->getQuery(true); | |
$query->select($db->quoteName(array('id'))) | |
->from($db->quoteName('#__categories')) | |
->where($db->quoteName('published') . ' = ' . $db->quote('1') . | |
' AND ' . $db->quoteName('extension') . ' = ' . $db->quote('com_content')) | |
->order('LFT ASC'); | |
$db->setQuery($query); | |
$categories = $db->loadObjectList('id'); | |
foreach ($categories as $category) | |
{ | |
foreach ($this->intro_items as $key => $intro_item) | |
{ | |
if ($intro_item->catid == $category->id) | |
{ | |
$this->intro_items[] = $intro_item; | |
unset ($this->intro_items[$key]); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment