optional part of a template

How do you create an optional bit of code in a  template?

raestanton, 7 years ago

I had success by including an entire section within a <repeater>, like this:

<div class="sideBox">
  <h3><$title link='true' default='Enter your title'$></h3>
  <$description default='<p>Enter your description</p>'$>

If the user deletes the section then everything simply disappears!

See if that works for you.

neonWired, 7 years ago

Thanks, haven't tried that yet but it should work.

brendan, 7 years ago

While this does work most of the time - it's a bit limiting when you already have repeating items in a block of code you want to make optional.

Could CampaignMonitor pretty please add an <optional> tag of some sort? :)


Eystein, 7 years ago
raestanton :

I had success by including an entire section within a <repeater>

That's brilliant, I hadn't thought about that. Thanks!

Edit: also, it works in my template.

derick2499, 7 years ago

thanks for the post

See why 200,000 companies worldwide love Campaign Monitor.

From Australia to Zimbabwe, and everywhere in between, companies count on Campaign Monitor for email campaigns that boost the bottom line.

Get started for free