Search in the Documentation:

Templates and Views

As presented in the previous section, Jahia 6.5 introduced a new editable template system that makes it easy to customize basic or even complex layouts without any scripting skills. In order to better understand how a page is composed, we will now illustrate this in the following schema:

[image]

In the example presented above, we are requesting a content object from the Java Content Repository that is located on the home page called “bellini”. Jahia will therefore first use the URL to find the corresponding content object, and then start looking for different objects that will help render the final page. In this specific example, we are not requesting a page, but a content object directly, which is a little more complex. If we had wanted to render the page, we would have used the following URL: http://www.dogsandcats.com/home.html . Jahia would have then looked for a page template, scanned it to find all the different objects present on the page, and then used views to render each specific object type. In the case of the above example, we have illustrated a more advanced use case, where we directly request a content object.

If all we had for a content object was a view script, when requesting an object by itself, we would probably only get an HTML fragment rendered instead of a complete page (as object views are designed to be re-used within pages). In order to avoid this, Jahia has a mechanism called the “content template” that allows integrators to design a template specific to a content object type that will be used to “decorate” around the object itself, allowing, for example, to render navigation, headers and footers around the object. The rendering of a full HTML page for a single content object then becomes quite similar to the case of rendering an actual content page.