List of Lists Module

marcelf

Member
Hi all,

I don't know if someone already had this need, but I think could be useful if we have a List of Lists Module. Basically, this module could be like an article module, showing the recent or more popular lists and giving access to them. I need put this in the home page of my portal.

Is there something like this OR must be developed?

Thanks,
Marcel
 
You could do that pretty easily with some custom code (using Sourcerer) in a normal J! custom module ...

Code:
[source]
<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('id, label')->from('#__fabrik_lists')->order('hits DESC')->setLimit(10,0);
$db->setQuery($query);
$lists = $db->loadObjectList();
$html = array();
foreach ($lists as $list) {
   $html[] =  '<a href="' . JRoute::_('index.php?option=com_fabrik&view=list&listid=' . $list->id) . '">' . $list->label . '</a>';
}
echo implode('<br />', $html);
?>
[/source]

You could vary the query, like order by label instead of hits, change the setLimit (number to show), etc. And change the formatting - I'm just shoing doing a simple linebreak separated list, you could format it as a table, or an ordered list (ul) etc.

-- hugh
 
I know, right? :)

I'd completely forgotten about that till I was looking at this thread, and the 'popular' part, and remembered seeing that column in the fabrik_lists table. It just counts the number of times a list has been viewed. Note that means how many times the list itself has been viewed, not how many times a row has been viewed from the list. It uses a built in J! method for tables, $table->hit(), that just increments a 'hit' field if it exists, usually called from the view for that table. The 'article' view uses it in J!.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top