Conditional block

76 views
Skip to first unread message

damon

unread,
Apr 14, 2010, 4:22:34 PM4/14/10
to RedDot CMS Users
Hi guys,
I have some html code with an img element ("img_Image1") and an
attribute of the image element ("att_Image1"), encased in a
conditional block. Now, both elements have to be present for it to
show. Is there any way to elegantly omit the attribute from the
conditional check? The attribute contains image credits and is
sometimes blank.

I would prefer to not use any preexecute code. Any help would be much
obliged.

Chris Nixon

unread,
Apr 14, 2010, 4:32:38 PM4/14/10
to reddot-c...@googlegroups.com
Just pull the element outside of the conditional?

Chris Nixon
Director of Communication Technology Services
University Relations - University of Arkansas
800 Hotz Hall - Fayetteville, AR 72701
479-575-5629

--
You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group.
To post to this group, send email to reddot-c...@googlegroups.com.
To unsubscribe from this group, send email to reddot-cms-use...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/reddot-cms-users?hl=en.

damon

unread,
Apr 16, 2010, 8:57:30 AM4/16/10
to RedDot CMS Users
That's what I do normally but I was hoping there was some alternative
to that.

kimdezen

unread,
Apr 19, 2010, 11:45:19 PM4/19/10
to RedDot CMS Users
You could do this with render tags, but i generally do this with some
ASP/VBScript:

<%

imgValue = "<!IoRangeConditional>True<!IoRangeRedDotMode><!
IoRangeNoRedDotMode><%img_Image1%><!/IoRangeNoRedDotMode><!/
IoRangeRedDotMode><!/IoRangeConditional>"
attValue = "<!IoRangeConditional>True<!IoRangeRedDotMode><!
IoRangeNoRedDotMode><%att_Image1%><!/IoRangeNoRedDotMode><!/
IoRangeRedDotMode><!/IoRangeConditional>"

%>

<% if "<%img_Image1%>" = "True" and "<%att_Image1%>" = "True" then %>

.. output code here

<% end if %>

Whenever values are assigned to each RedDot placeholder, the
corresponding variable will be assigned with the string "True". If no
value is found, the variable will be assigned with an empty string
value. Its worth noting that when the page is open for editing, the
value for each variable will always be set to "True".

Remeber to also wrap the code around a Pre-executing script block...

Kim.

kimdezen

unread,
Apr 19, 2010, 11:47:03 PM4/19/10
to RedDot CMS Users
Ummm yeah... sorry about that! I should have read your post more
clearly when it said 'Prefer not to use Preexecute code'!!!!

kimdezen

unread,
Apr 20, 2010, 12:06:32 AM4/20/10
to RedDot CMS Users
Try this:

<!-- <%img_Image1%> -->
<reddot:cms>
<if>
<query
valuea="Context:CurrentPage.Elements.GetElement(img_Image1).GetHtml()"
operator="!=" valueb="String:">
<htmltext>

<!IoRangeConditional><img src="<%!!
Context:CurrentPage.Elements.GetElement(img_Image1).GetHtml()!!%>"
alt="<%att_Image1%>"><!/IoRangeConditional>

</htmltext>
</query>
</if>
</reddot:cms>

You'll need to make sure that the image placheolder (img_Image1) is
sitting somewhere in the template - and isnt just referenced within
Render tags - otherwise your image will fail to publish (the reason
why it is commented out above the render tag block)

Its worth nothing that this workaround wont work if you add extra
attribute values (such as height, width etc) within the conditional
block. (Unfortunately you are unable to check for values within
attributes or info elements using render tags. )

Hope that helps!

Cheers,
Kim


On Apr 15, 6:22 am, damon <damon....@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages