O'Reilly logo

FuelPHP Application Development Blueprints by Sébastien Drouyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Parser package and template engines

You may notice that we added the parser package into the always_load.package key. Thanks to this package, instead of writing our view in PHP, we are able to use template engines. For those of you that are not familiar with template engines, they allows us to write our view files in a different syntax.

For instance, a list of items might be displayed by writing the following code in PHP:

<h1>Items</h1>
<?php foreach ($items as $item) { ?>
    <li><?php echo $item->title ?></li>
<?php } ?>
<a href="item/create">Create an item</a>

But, using the HAML template engine, it can be written like this:

%h1 Items
- foreach ($items as $item)
  %li
    = $item->title
%a(href="item/create") Create an item

Alternatively, by using the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required