Plugin

Developer
Supported

Pvl Check If

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From Pv Ledoux

     

You must be logged in to post.

3 Conditions-How To?

Support Request

Boyink
Boyink

Hi -

I’m trying to use this plugin to work with search results from Google within Lows Google Search addon.

I have 3 situations to handle

- If the returned URL has “video-player” in it - apply unique styles.
- If the returned URL has “careers” in it - apply unique styles.
- If the returned URL has neither of the above 2 terms in it - apply default style.

I can only seem to get the “contains” approach working.  This works:

{exp:pvl_checkif value="{url}" contains="video-player"}
  Video
 {
/exp:pvl_checkif} 

This does not:

{exp:pvl_checkif value=“video-player” is_in=“{url}”}
  Video
 {
/exp:pvl_checkif} 

I’ve tried the following to “stack” the plugin:

{exp:pvl_checkif value="{url}" contains="video-player"}
                  Video
                  {else}
                    {exp
:pvl_checkif value="{url}" contains="careers"}
                      Career
                      {else}
                        Something not career 
or video
                    {
/exp:pvl_checkif}
                {
/exp:pvl_checkif} 

But I get the following rendered to the page:

Career {/exp:pvl_checkif} 

Can you suggest a coding approach to handle this situation?

pvledoux
# 1
Developer
pvledoux

Hi Michael,
I have never tried to nested it actually. Let me do some test, and I will let you know.
But if you are in hurry, maybe you should try to do it with switchee and regex. Switchee is nestable.

Boyink
# 2
Boyink

Ah ok. Switchee it is. For some reason wasn’t thinking of that one. Thanks!

pvledoux
# 3
Developer
pvledoux

Hi Michael, sorry, it has been a tough week. Did you managed to do it with switchee? I can confirm that my plugin is not nestable.
Maybe I should implement some more complex conditions (with AND and OR operators) and a else:checkif tag.
As Switchee is in the place now, I’m not sure if it will be a useful way to spend time anyway ;)

Boyink
# 4
Boyink

Yes, Switchee is in place and working well.  Thanks!