optional part of a template

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

raestanton, 6 years ago

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

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

If the user deletes the section then everything simply disappears!

See if that works for you.
Rae

neonWired, 6 years ago

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

brendan, 6 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? :)

Thanks!

Eystein, 6 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, 6 years ago

thanks for the post

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098