Lava

You are here:

What Is Lava

Rock is about power and flexibility. Lava adds both by allowing you to tailor the application to meet your specific needs. Lava is based on the Liquid templating engine (get it... lava is liquid rock...) developed by Shopify for their e-commerce platform. It is now used in numerous web applications. We’ve taken it and added a ton of new features specific to Rock.

Learning Lava's simple syntax will make you unstoppable as you work more closely with Rock. Lava truly is simple. In fact, there are only two types of markup in Lava, output and tags. This markup is placed inside of your HTML content to make it more dynamic as you mix in your data.

Output Markup

Like the name portrays, output tags are used to put data into your markup. Say you're working on some content for your external website and you wanted to personalize the page’s content for the currently logged in user. Luckily the HTML control gives you access to the logged in user via the 'Person' property. Using this we could use an output tag like:

Hello {{ Person.NickName }}!
This would place the nick name of the currently logged in user into the message. Pretty simple, right? In fact the hardest part about output tags is knowing what data you have access to use with them. We’ve tried to provide you with that by allowing you to display the data using 'Debug' block settings. We’ve also added documentation here to help assist you.

Output markup is great, but when you use filters they become supercharged goodness! Learn about filters under Intro To Filters.

Tags

Sometimes your desired output won't be as straight forward as placing output tags in your HTML. There will be times when you need to add a bit more logic. For instance in our hello example... what would happen if no one was logged on that page? Based on the way it was written the user would see 'Hello !'. Not horrible, but we can do better! Tags allow us to add logic to our markup. Consider for a moment the 'if' tag below.

{% if Person.NickName %}
    Hello {{ Person.NickName }}!
{% else %}
    Hi! Consider logging in for a more personal experience.
{% endif %}

If the user is currently logged in they see a nice personalized message. If not, they’re reminded that they're missing something.

This is just the tip of the iceberg on tags. Drill into each tag available in Rock by clicking on them in the sidebar.