Conditional rendering in templates

Templating a website is an effective way to avoid repeated content and the associated maintenance overhead. There are occasions when this common content needs to be replaced for one or two exceptional pages; for example, a homepage may require slightly different header information than other pages in a site. This problem can be solved by the homepage not utilizing a template, but this then means that any common content that the homepage does require is repeated in the homepage and the template.

In this recipe we will create a Visualforce template that provides header and footer content. A page may override the header text provided by the template. We will then create two Visualforce pages that utilize this template: ...

Get Visualforce Development Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.