Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > d2229253b8f3127ab89b179a82cc8466 > files > 507

libqxt-devel-0.6.1-2.fc15.i686.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /builddir/build/BUILD/libqxt/src/web/qxthtmltemplate.cpp -->
<head>
  <title>QxtHtmlTemplate Class Reference</title>
  <link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://libqxt.org"><img src="images/qxt-logo.png" width="50" height="40" align="left" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">Classes</font></a>&nbsp;&middot; <a href="namespaces.html"><font color="#004faf">Namespaces</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QxtHtmlTemplate Class Reference<br /><span class="small-subtitle">[<a href="qxtweb.html">QxtWeb</a> module]</span>
</h1>
<p>The QxtHtmlTemplate class provides a basic HTML template engine <a href="#details">More...</a></p>
<pre>    #include &lt;QxtHtmlTemplate&gt;</pre><p>Inherits <a href="http://doc.qtsoftware.com/4.5/qmap.html">QMap&lt;QString, QString&gt;</a>.</p>
<ul>
<li><a href="qxthtmltemplate-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"></div><b><a href="qxthtmltemplate.html#QxtHtmlTemplate">QxtHtmlTemplate</a></b> ()</li>
<li><div class="fn"></div>void <b><a href="qxthtmltemplate.html#load">load</a></b> ( const QString &amp; <i>d</i> )</li>
<li><div class="fn"></div>bool <b><a href="qxthtmltemplate.html#open">open</a></b> ( const QString &amp; <i>filename</i> )</li>
<li><div class="fn"></div>QString <b><a href="qxthtmltemplate.html#render">render</a></b> () const</li>
</ul>
<ul>
<li><div class="fn"></div>41 public functions inherited from <a href="http://doc.qtsoftware.com/4.5/qmap.html#public-functions">QMap</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QxtHtmlTemplate class provides a basic HTML template engine</p>
<p>open a file containing html code and php style variables. use the square bracket operators to assign content for a variable</p>
<pre>    QxtHtmlTemplate index;
    if(!index.open)
            return 404;
    index[&quot;content&quot;]=&quot;hello world&quot;;
    echo()&lt;&lt;index.render();</pre>
<p>the realatet html code would look like:</p>
<pre>    &lt;html&gt;
    &lt;head&gt;
            &lt;title&gt;Test Page&lt;/title&gt;
    &lt;/head&gt;
            &lt;?=content?&gt;
    &lt;/html&gt;</pre>
<p>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, <a href="qxthtmltemplate.html#render">render</a>() will never return.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QxtHtmlTemplate"></a>QxtHtmlTemplate::QxtHtmlTemplate ()</h3>
<p>Constructs a new <a href="qxthtmltemplate.html">QxtHtmlTemplate</a>.</p>
<h3 class="fn"><a name="load"></a>void QxtHtmlTemplate::load ( const <a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> &amp; <i>d</i> )</h3>
<p>Loads data <i>d</i>.</p>
<h3 class="fn"><a name="open"></a>bool QxtHtmlTemplate::open ( const <a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> &amp; <i>filename</i> )</h3>
<p>Opens <i>filename</i>. Returns <tt>true</tt> on success and <tt>false</tt> on failure. Note that it will also return false for an empty html file.</p>
<h3 class="fn"><a name="render"></a><a href="http://doc.qtsoftware.com/4.5/qstring.html">QString</a> QxtHtmlTemplate::render () const</h3>
<p>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</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td align="left">Copyright &copy; 2007-2010
<a href="mailto:foundation@libqxt.org">Qxt Foundation</a></td>
<td align="right"><div align="right">
<a href="http://libqxt.org">Qxt</a> 0.6.1</div></td>
</tr></table></div></address></body>
</html>