Hardhat Framework

View

Smarty

Hardhat uses Smarty templates for the view. The navigation action will take care of loading the appropriate data into the beans, and then call smarty to display the template. The template then accesses data contained in those beans.

You are not locked into using Smarty if you don't want to use it. You can always change the code in the navigation action to include a php file instead. The examples in the documentation will be using Smarty however.

You can read about why I like Smarty here.

A typical template would look something like this:


{include file="header.tpl"}

<h1>Edit User>/h1>

<form id="userForm" method="post" action="/user/update">
    <div class="formLayout">
        <label>First Name</label>
          <input type="text" id="firstName" name="firstName" value="{$user->getFirstName()}" /><br>
        
        <label>Last Name</label>
          <input type="text" id="lastName" name="lastName" value="{$user->getLastName()}" /><br>
        
        <label>Email Address</label>
          <input type="text" id="emailAddress" name="emailAddress" value="{$user->getEmailAddress()}" /><br>
          
          <br><input type="submit" id="submit" name="submit" value="update" /><br>

    </div>
</form>

{include file="footer.tpl"}