Posted by mikeytown2 on January 26, 2011 at 2:17am
I'm well aware of Views Or; I'm looking for something that would do a Conditional Filter. Example:
I have a CCK field called showcase. If there is any node with the showcase field set to TRUE then I only want to display nodes of that type. But if none of my nodes have showcase selected then I would like to ignore this filter to still display nodes in this view. View has a random sort; also using sorting to do filtering doesn't seem like the correct way to do this.
Has anyone created a views plug-in like this?
Comments
Views PHP Filter
Recently discovered this module. Looks like it can do what I need.
http://drupal.org/project/viewsphpfilter
Arguments with a default value
Hi.
I do see why you can not simply set an Argument filter to Content>Showcase, although it might be possible with View Relationships.
If you were using Panels, there are a few paths including raw PHP that evaluates 2 different views, and decides which to display (and actually, something like this could probably work as a Block). Panels Variants can use PHP selection code to choose which variant to display (and 2 variants, each containing a view matching the two types of results you want).
I don't know the benefits of viewsphpfilter, but good locations to put PHP code in are Argument filters and also the General Settings>Header. In either one I think you need to invoke views_get_current_view(), and then you can get or set things in the $view object.
Scott