$model->setState - get only featured articles

For Joomla! 2.5 Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general
Note: All 1.6, 1.7 and 3.5 releases have reached end of life and should be updated to 3.x.

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Locked
Mik3e
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Mon Feb 13, 2006 10:53 am

$model->setState - get only featured articles

Post by Mik3e » Mon May 31, 2010 2:46 pm

Hi there,

I'm working on a small module wich returns the latest articles wich are marked as "featured".
In 1.6 there is a new method to manipulate the output of the com_content model called $model->setState.

There are several parameters to manage the request for articles over the model. For example:
$model->setState('list.ordering', $ordering);
$model->setState('list.direction', 'ASC');
$model->setState('filter.published', 1);

....

No I want to ask if there is anywhere a short documentation of this method and the available settings, cause i want to only return articles, wich are marked as "featured".

I already tried $model->setState('filter.frontpage',1); and $model->setState('filter.featured',1); but both don't work.

Has anyone already tried to use the setState function in a 1.6 Module?

Thanks & cheers,
Mike

pannerrammer
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Thu Dec 04, 2008 11:14 am

Re: $model->setState - get only featured articles

Post by pannerrammer » Mon Sep 12, 2011 1:11 pm

I've just hit the same problem. Did you find the answer? Thanks, Phil

And almost as quickly I stumble upon the solution!
Featured:

Code: Select all

$model->setState('filter.featured', 'only');
Not-featured:

Code: Select all

$model->setState('filter.featured', 'hide');
Both:

Code: Select all

$model->setState('filter.featured', 'show');

User avatar
uaintgotthisid
Joomla! Explorer
Joomla! Explorer
Posts: 367
Joined: Wed Sep 10, 2008 6:05 pm
Location: Essex, England, United Kingdom
Contact:

Re: $model->setState - get only featured articles

Post by uaintgotthisid » Sat Oct 08, 2016 12:47 pm

Did anyone ever solve this? I'm trying to work out if I can use setstate to show/hide intro text and intro image
Joomla lover, web designer, marketeer
https://www.squareballoon.co.uk
JOIN US at Joomla! User Group London
https://www.joomlalondon.co.uk


Locked

Return to “Joomla! 2.5 Coding”