Martooti
Member
Hi,
since my problem with limit for list query wasn't solved till now. I made a custom list template where I use the query. The point is that I would like to use it with different tables so I have to override the table that I have with curent table name. Is that possible to do?
As you see below my table name is fb_rightmiddlebanner but how can I get it dynamically?
Columns are the same in other tables.
My query:
since my problem with limit for list query wasn't solved till now. I made a custom list template where I use the query. The point is that I would like to use it with different tables so I have to override the table that I have with curent table name. Is that possible to do?
As you see below my table name is fb_rightmiddlebanner but how can I get it dynamically?
Columns are the same in other tables.
My query:
Code:
$app = JFactory::getApplication();
$menu = $app->getMenu()->getActive()->id;
$db = JFactory::getDbo();
$db->setQuery("SELECT * FROM fb_rightmiddlebanner WHERE `category`=
(SELECT m.id FROM jos_menu AS m
INNER JOIN fb_rightmiddlebanner AS b ON b.category = m.id
WHERE lft <= (SELECT lft FROM jos_menu WHERE id = $menu)
AND rgt >= (SELECT rgt FROM jos_menu WHERE id = $menu)
ORDER BY rgt LIMIT 1) AND `published`='1';");
$all_banners = $db->loadObjectList();
$banner = $all_banners[0]; ?>