PDA

View Full Version : Using {vb:raw} in templates conditionals?


Spit-wad
07-09-2014, 07:59 AM
I'm aware you can't use those in template conditionals, but i dont have a single clue on how to do what i want to do w/o doing that.

Right now i'm working on a mod where moderators are able to flag an user post for hidding, and it is supposed to work just like a ignore but for that post only.

Right now i'm reading the postids from the flaged posts, from a table and preregistering it in a template. i wanted to do something like

<vb:if conditional:"in_array("{vb:raw post.postid}", {vb:raw postidarray}")>, but as you guys know, i can't use vb:raw in conditionals for some reason

Is there some sort of workarroud?

mokujin
07-09-2014, 08:03 AM
{vb:raw post.postid} => $post['postid']

{vb:raw postidarray} => $postidarray

So, your code should look like this:

<vb:if condition="in_array($post['postid'], $postidarray)>Blhahahah</vb:if>

Spit-wad
07-09-2014, 08:15 AM
Thanks for the help!.

I'm still getting a "Parse error: syntax error, unexpected '{' " error tho :(

Dave
07-09-2014, 08:18 AM
mokujin forgot a closing ".


<vb:if condition="in_array($post['postid'], $postidarray)">
Blhahahah
</vb:if>

Spit-wad
07-09-2014, 08:36 AM
i get this: The following error occurred when attempting to evaluate this template:
%1$s

But it still works when i go thru, so thanks you both !