![]() |
Home · Modules · Classes · Namespaces · Functions |
The QxtHtmlTemplate class provides a basic HTML template engine More...
#include <QxtHtmlTemplate>
Inherits QMap<QString, QString>.
The QxtHtmlTemplate class provides a basic HTML template engine
open a file containing html code and php style variables. use the square bracket operators to assign content for a variable
QxtHtmlTemplate index; if(!index.open) return 404; index["content"]="hello world"; echo()<<index.render();
the realatet html code would look like:
<html> <head> <title>Test Page</title> </head> <?=content?> </html>
funny storry: whe are using this class to make our documentation (eat your own dogfood, you know ;). but when we where parsing exactly this file you read right now the first time, QxtHtmlTemplate got stuck in an infinite loop. guess why. becouse of that example above :D So be warned: when you assign content to a variable that contains the variable name itself, render() will never return.
Constructs a new QxtHtmlTemplate.
Loads data d.
Opens filename. Returns true on success and false on failure. Note that it will also return false for an empty html file.
Uses the variables you set and renders the opened file. returns an empty string on failure. Does NOT take care of not assigned variables, they will remain in the returned string
Copyright © 2007-2011 Qxt Foundation |
Qxt 0.6.2 |