Custom Layouts - Handling missing / empty values

FAQ

One of the repeated requests that came from our members was to have the ability to show different layouts dependent if a field has a value or not.

From JEvents 1.5.5 and upwards, we have implement a new feature which allows you to do this.

For example if you only sometimes use the extra info field then you can use this code

{{Extra Info:EXTRAINFO#Extra info is %s#No Extra info}}

If you are using the standarised image addon and some of your events don't have an image then you may want to show a placeholder image instead of the blank space to ensure the layout is preserved.

If in your layout default you add this

{{Location Image:JEVLOCATION_IMAGE#%s# <img src="http://yourdomain.com/images/yourimage.jpg" border="0" />}}


Then if the image is present it will be used but if not then it will use the alternative image (in this case you would need to make sure that the location component parameters has "" set to yes).

You can use the same technique to show labels for a field conditional on if the field has a value or not.