0

I am trying to understand how slideshow modules fetch the content from joomla once the required categories are selected in the admin panel. Such modules fetch the articles' title, full text, image, link etc from the category/s selected by site owner in the administrative panel of the website.

So once a module has the category to fetch the articles from,

  1. what api is used to get the article IDs from the category?
  2. Once the article IDs are obtained, what api is used to fetch the contents of each article?
  3. Or is there an api that fetches all required elements of the articles just by passing the category?

I am using Joomla 2.5.9

I am trying to understand if I can override this "fetching the articles based on category" functionality by looking at the existing code and making my own modifications. Or even hack the joomla core for my purpose. All this for the purpose of creating a plugin for the functionality tweaking I have in mind.

1 Answer 1

3

Hi Joomla uses a MVC strucuture of accessing data.

If you are selecting information from the all you need to is set the "model states" that it wants.

In joomla 2.5 in the default content manager you would so like this

$model = JModelLegacy::getInstance('Articles', 'ContentModel', array('ignore_request' => true));
$model->setState('filter.category_id' 'YOURIDYOUWANTTOFILTERON');
$model->getItems();

That code will give you an array of objects, so you can loop through like with a foreach loop. There are a large number of model states,

there is no reason you would need to hack the core in anyway to data from the content model

1
  • Makes perfect sense as to where I want to start. Feb 19, 2013 at 19:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.