Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

If variable is blank


Reply


2 Posts   2179 Views

Avatar
DanStephenson

Community Member, 116 Posts

29 April 2009 at 5:38pm

Hi everyone,

I am building a site right now, that has a place for a user to enter custom content into their sidebar. This content shows up inside a custom div, with a background image.

Is there a way, inside my templates, that I can essentially say "only if this content has been entered in the CMS (field is not blank/not NULL), than show this variable, else, ignore it?"

Avatar
DanStephenson

Community Member, 116 Posts

29 April 2009 at 5:43pm

Nevermind, I figured this out. For anyone else who may need this, here is the code, assuming you're working with the variable called SidebarContent

<% if SidebarContent %>$SidebarContent<% end_if %>

Notice that the <% if SidebarContent %> does not contain a dollar sign ($), this is what was messing me up.