G
G
goshaLoonny2021-03-01 21:16:25
Joomla
goshaLoonny, 2021-03-01 21:16:25

How to get banners in Joomla 3.9?

How can I get banner images using PHP in Joomla 3.9? Of course, you can get them from the database using crutch methods, but is it possible to do this using built-in methods?

This is how I get the currently existing banners for example

$db = JFactory::getDbo();

$query = $db->getQuery(true);
$query->select($db->quoteName(array('id', 'name', 'params')));
$query->from($db->quoteName('#__banners'));

$db->setQuery($query);

$results = $db->loadObjectList();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Gruznykh, 2021-03-02
@goshaLoonny

Something seems to me that you are trying to reinvent the wheel without knowing the standard functionality of Joomla. There is also a standard module that displays banners of a given category / a given client. In the "Banners" component you create banners, set the number of impressions and other settings for them, and display them in the specified position using the module. Read an article on the topic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question