Server Page Templates

From HTML5 Builder
Jump to: navigation, search

Templates let you separate the logic from the interface. That way, designers can focus on the HTML and CSS code that defines your application visually, as well as images and other resources. Then, you can use components to add logic and live content to the application, on top of the template.

Since you can use a template file with several pages, the usage of template engines also favors code reuse, and makes it easy to apply style changes all over your application.

To use a template on a server page:

  1. Develop a template file. The syntax for the template files depends completely on the template engine you are going to use, so check out the available engines, decide which one you want to use, and learn how to define a template file with it.
  2. On the Page container:
    1. Set TemplateEngine to the template engine of your choice.
    2. Point TemplateFilename to the target template file.

Template Engines

The RPCL supports by default the following template engines:

Smarty
A powerful PHP template engine.
RPCL
Previously known as VCL, the RPCL template engine is an extension of the Smarty engine which includes RPCL-specific features.

Help Resources

Frequently Encountered Problems

Access is denied

When using templates with your applications, you might run into the following error:

Application raised an exception class UnexpectedValueException with message 'RecursiveDirectoryIterator::__construct(<path>,<path>): Access is denied. (code: 5)'

This is usually caused by another application creating temporal content without read-access in your temporal directory.

To workaround this issue:

  1. Create a new folder in your temporal directory. For example: C:\Users\YourUsername\AppData\Local\Temp\HTML5Builder.
  2. In the RPCL folder, you will find a file named smartytemplate.inc.php. Open it.
  3. Locate the line with the code $this->_smarty->compile_dir = $tmpfolder;, and append the new temporal subfolder to the $tmpfolder variable. For example: $this->_smarty->compile_dir = $tmpfolder."/HTML5Builder";.
  4. Save the changes to the file.

    Note: You might need to change the permissions of smartytemplate.inc.php to be able to modify it.

See Also