Sorry, after I posted I realized my mistake. I had to re-enable the haystack. So, the important bits:
global $TMPL, $DB, $FNS;
$tagdata= $TMPL->tagdata;
$haystack = $TMPL->fetch_param('haystack');
$needle = $TMPL->fetch_param('needle');
Then:
if($needle === false)
{
...stuff...
}
else
{
$cond = array();
$cond['string_match'] = ( strpos($haystack,$needle) !== FALSE ) ? TRUE : FALSE;
$tagdata = $FNS->prep_conditionals($tagdata, $cond);
$this->return_data = $tagdata;
}
Template:
{exp:simple_string_match haystack="{link_url}" needle="viewthread"}
{if string_match}
Hey, it's a forum link
{if:else}
Not a forum link
{/if}
{/exp:simple_string_match}
Doing it that way could get dicey if you’re passing a lot of stuff through the haystack-as-parameter (perhaps if there are quotes or weird characters) but I’m only searching a small field. I’d rather search tagdata, but I couldn’t quickly find a decent example of a way this has been done, where I could then use a simple conditional.