Beefree if than statements | Community
Skip to main content
Level 2
April 10, 2026
Solved

Beefree if than statements

  • April 10, 2026
  • 1 reply
  • 32 views

we recently got beefree and are using it to push emails/templates into marketo. The one thing I am struggling with is using the beefree display conditions to work with segements/fields in marketo to show the correct content. Does anyone know or have expeience using the correct statements/syntax to get things to work?

Best answer by SanfordWhiteman

{{my.Main Content - Burger Top}} is

#define( $main )

 

{{my.Main Content - Burger Buttom}} is

#end
#set( $mainHTML = $main.toString() )

 

Now you have the content in the Velocity context as $mainHTML. and can conditionally output it in subsequent tokens.

1 reply

SanfordWhiteman
Level 10
April 13, 2026

You’d need to create Velocity {{my.tokens}} and wrap the Beefree content in them. This is known as the “defineburger” technique developed by me and ​@Jo_Pitts1.

 

The opening {{my.token}} uses #define( $variable ); the closing {{my.token}} uses #end. Those are the buns, the content is the meat, if you will.

 

Then you have the content captured in a Velocity $variable and can conditionally output it based on additional Velocity logic. (That logic can be in the closing token or, more manageably, in another {{my.token}} located directly after.)

 

You have to be proficient at Velocity Template Language to make this work.

matthardyAuthor
Level 2
April 13, 2026

Could you give me an example on how this is done?

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
April 13, 2026

{{my.Main Content - Burger Top}} is

#define( $main )

 

{{my.Main Content - Burger Buttom}} is

#end
#set( $mainHTML = $main.toString() )

 

Now you have the content in the Velocity context as $mainHTML. and can conditionally output it in subsequent tokens.