Common VaeML Mistakes - June 11, 2009

While we do think VaeML is a pretty simple language to use, mistakes do happen. Today we'll cover a few things that even we stumble over sometimes. We might try to make this a reoccurring series as we notice new trends in our troubleshooting efforts. Remember, anytime you have a problem with your code, your account manager can help you find the culprit.

Remember What Context You're In

A common mistake early on is to try to specify a path to a Structure that doesn't exist, because you're in the wrong context. Say we have a collection called 'Artists' which contains Albums, Artist Bio, Artist Genre. Assuming Albums doesn't contain a Structure that's also called 'Artist Genre', this code won't work:

<v:collection path="Artists" filter_input="query">
Here's the albums by <v:text path="artist" />:
<v:collection path
<v:text path="album_name" />
<v:text path="artist_genre" />

The problematic code is bolded. Since 'Artist Genre' is a Substructure of Artists and not Albums, this path is incorrect. To fix it, and grab the Artist Genre succesfully, we'd need to go up one level:

<v:text path="../artist_genre" />

Image Sizes Are Case Sensitive

Is the crop you setup in the Backstage not showing up on your site? One thing to check is that you spelled your Image Size correctly, and that you have the correct capitalization. The latter trips up a lot of people. Vae doesn't make Image Sizes all lowercase, nor replace spaces with underlines, as it does with xpaths. Instead, and Image Size called 'Big Square' should be used to like this:

<v:img path="about_us/photo_of_employees" image_size="Big Square" />

Don't Close Shortcut Tags

Shortcut tags aren't like other tags, in that they should not be closed (even self closed!). Here's a piece of code that would cause an error:

<div style="background: url(<v=/styles/background_image,480,360 />);"></div>

Instead, you should remove the self-closing '/':

<div style="background: url(<v=/styles/background_image,480,360>);"></div>