Split/Break after each Category in Categories view

More
9 years 9 months ago #52309 by ggppdk
Hello

with a few lines of php code you can have a performance wise result:
Performance wise because:
- single SQL query
- sql Query with no ordering clause



ON the TOP of
category_items(_html5).php
Code:
$_cat_ids = array(); foreach ($this->items as $_item) { $_cat_ids[] = $_item->catid; // main cat only // For GitHub version use: //$_cat_ids[] = $_item->rel_catid; } $q = "SELECT * FROM #__categories" ." WHERE id IN(" .implode(', ', $_cat_ids). ")"; $_db = JFactory::getDBO(); $_db->setQuery($q); $_cats_data = $_db->loadObjectList('id');


then use:
Code:
echo $_cats_data[$item->catid]->title; // For GitHub version use: //echo $_cats_data[$item->rel_catid]->title;



Please correct any PHP SYNTAX errors, i have not checked the above


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.476 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline