Faceplait Docs: Using the Factory to Produce Layout-Wrapped Content

The HTMLViewFactory is what produces an instance of BasicView which contains decorated page layout - the final results as it were. Asking for a view is as simple as invoking the getView() method on the factory passing in a reference to our Page instance. We're not going to apply our custom layout just yet.

Without providing the instance of our layout to the getView() method, Faceplait will decorate our page with a default layout - which isn't one that you want to use for obvious reasons. It does this to indicate that the library is operating correctly. The results;

Our original page was decorated as expected, with the default layout. Like I said, it's not a layout you want to keep - which is why we're going to replace it with the one we created earlier. In order to do that, we need to provide the layout reference to the getView() factory method.

Re-rendering the content now produces the page decorated with our custom (albeit simple) layout we defined previously.

In the next section I'll show you how to create a layouts cache within the factory to simplify the application of page layouts.

<< Creating Reusable Layouts    Creating a Layout Cache within the Factory >>

Quick Nav

All Modules

In Touch

Featured Module

Contribute

Download Now