Header Small Ahoy!

Loading Templates

If you have successfully followed the instructions on the previous page then you should now have an HTML template inside your 'templates' directory.

You can now load your template from any other module with the following line of code:



Let's assume that you'd like to have your own custom method inside our 'Welcome' controller (inside the 'welcome' module that comes with the framework). If your method was to be named 'greeting' then we could easily have our 'greeting' method display the public template like so:

function greeting() {

As you can see, this is very easy. However, there is one rather obvious problem: we haven't passed information from our module to our template!

Obviously, templates aren't much use if they just contain hard coded HTML. Our goal will almost always be to have templates that are dynamic. This means that our templates should be able to receive and display information from the methods from where they have been called.

We'll cover this on the next page.