joomla2.5 - How to get Joomla K2 item as object on category page? -
I need to get all the items in the specific K2 category as templates in templates / mytemplate / html / com_k2 / default / category. Php Something like this:
foreach ($ this-> class-> items as $ item) {echo $ item-> Image; } But I do not know that the 2 components of the API are secondary with its limit but all items in the current range are $ / not just this- & gt; Leading or $ this- & gt; Primary or $ this- & gt;
You can get it from MySQL directly by query:
Pre> $ catid = $ this- & gt; Category-> Id; $ Db = & amp; JFactory :: getDBO (); $ Query = $ db- & gt; GetQuery (true); $ Query-> ($ Db-> QuoteName (Select the array ('id', 'title', 'publish', 'command')) - & gt; From ($ db-> QuoteName ('#__ k2_items')) - & gt; Where ($ db-> QuoteName ('CatID') "=" $ db-> Citations ($ CatID)) - & gt; Order ($ db-> quoteName ('command'). 'ASC'); $ Db- & gt; SetQuery ($ query); $ ItemList = $ db- & gt; Load Objects List (); If (count ($ itemList)>) {foreach ($ itemList $ as item) {if ($ item,> published == 1) {echo '
Comments
Post a Comment