Update on if_article category · Mar 7, 04:47 pm by Rick Silletti
Tags shuffled to test for a match in either cat1 or cat2. If cat1 is a match the function is exited, if not, a match is looked for in cat2. There is a lot of room for originality here (and some for Excedrin).
<txp:ras_if_article_category1 name="second,list,test"> <p> 1 <txp:category1 /></p> <txp:else /> <txp:ras_if_article_category2 name="second,list,test"> <p> 2 <txp:category2 /></p> <txp:else /> <p>No Match for Categories</p> </txp:ras_if_article_category2> </txp:ras_if_article_category1>
Tags shuffled to look for a combination of matches in cat1 and cat2, more arbitrary, but not as difficult to get your head around.
<txp:ras_if_article_category1 name="test,list,second"> <txp:ras_if_article_category2 name="second,list,test"> <p> Both category one and two<br /> <txp:category1 /><txp:category2 /></p> </txp:ras_if_article_category2> </txp:ras_if_article_category1>
Functions go as follows:
function ras_if_article_category1($atts, $thing)
{
global $thisarticle;
extract(lAtts(array(
‘name’ => ‘’,
),$atts));
$cat = $thisarticle[‘category1’];
return parse(EvalElse($thing, in_list($cat, $name)));
}
function ras_if_article_category2($atts, $thing)
{
global $thisarticle;
extract(lAtts(array(
‘name’ => ‘’,
),$atts));
$cat = $thisarticle[‘category2’];
return parse(EvalElse($thing, in_list($cat, $name)));
}
Functions are in one plugin at the sidebar as ras_if_article_category.
The combo tag was clunky, square, and simply not going to fit in the round hole. The two tag approach may seem confusing at first, but it offers more flexibilty. (and they were easier to write)
