Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Iw expr and string comparison
Sus
I want find if an item contains a particular word in it and I am trying to use something like
<iw_if expr="{iw_value name='dcr.PageGrahic'/} eq '*_interior*'">
Now how do I give a wild card so that the item dcr.pageGraphic is matched to strings like "graphic_intinterior.jpg" or "interior_graphic.jpg" or "small_interior_gr.gif"
In this case dcr.pageGraphic contains the path to the image.
Any help is appreciated .
Find more posts tagged with
Comments
Adam Stoller
Try:
<iw_if expr="{iw_value name='dcr.PageGrahic'/}
=~ /
_interior
/
">
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
jefenzel
Hi Fish,
Thank you for replying to our question. However, the if-then is still not working. Here is the code:
<iw_if expr="{iw_value name='dcr.PageGrahic'/} =~ /_interior/">
<iw_then>
<div id="subheader" style="background:url(<iw_value name='dcr.PageGraphic' />) no-repeat; background-position:top right;">
<!-- BEGIN Main page heading -->
<h1><iw_value name='dcr.Metadata.Section' /></h1>
<!-- Use h1 tag for page heading -->
</div><!-- END Main Page heading -->
</iw_then>
<iw_else>
<div id="subheaderInner" style="background:url(<iw_value name='dcr.PageGraphic' />) no-repeat; background-position:top right;">
<!-- BEGIN Main page heading -->
<h1><iw_value name='dcr.Metadata.Section' /></h1>
<!-- Use h1 tag for page heading -->
</div><!-- END Main page heading -->
</iw_else>
</iw_if>
With the above code as it is, it defaults to the else statement no matter what image file I select. If I change the "=~" to "ne" it defaults to the then statement no matter which image is selected.
Any thoughts?
Thank you to anyone that can see my error!
Adam Stoller
<iw_if expr="{iw_value name='dcr.PageGrahic'/} =~ /_interior/">
Is that a typo in your post - or your code? I.e. it should be:
<iw_if expr="{iw_value name='dcr.PageGra
p
hic'/} =~ /_interior/">
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
jefenzel
Hi Fish,
Thanks for the extra set of eyes! Spelling the variable correctly and switching the contents of the iw_then and the iw_else worked.
Kind regards,
June Fenzel
IRI