Location: PHPKode > projects > PEAR::HTML_Template_Xipe - SimpleTemplate > examples/xmlConfig/index.tpl
    $Log: index.tpl,v $
    Revision 1.4  2002/06/02 22:38:56  mccain
    - convert all config-tags to lower case, this is secure for now
      also if the Tree-package is not updated

    Revision 1.3  2002/05/26 17:12:19  mccain
    - added log


    <options override="yes">
        <delimiter begin="[" end="]"/>
        <autoBraces value="true"/>
        <locale value="en"/>

        <title>Example - SimpleTemplate, XML-configured</title>
        <link href="../style.css" type="text/css" rel="StyleSheet">


<h2>XML-configured template</h2>

<a href="http://sourceforge.net/projects/simpletpl/">DOWNLOAD</a><br>
This example uses both possible ways to configure this template, it first reads the
<a href="[$viewConfigXmlUrl]">config.xml which is in the same directory as the template</a>
and it reads the xml-data which are inside
<a href="[$viewTemplateCodeUrl]">this template file</a>, surely this doenst make much sense in this
example, but it demonstrates how the config might be applied.<br>
You can put the config.xml file anywhere in the 'templateDir' if it is found on the path to the template
it will be applied.

This is the XML-part which configures this template, either in the
<a href="[$viewConfigXmlUrl]">config.xml</a> or/and in this
<a href="[$viewTemplateCodeUrl]">template-file (index.tpl)</a>.<br>
 &nbsp; &lt;options override="yes"&gt;<br>
 &nbsp;  &nbsp; &lt;delimiter begin="\[" end="\]"/&gt;<br>
 &nbsp;  &nbsp; &lt;autoBraces value="true"/&gt;<br>
 &nbsp;  &nbsp; &lt;locale value="en"/&gt;<br>
 &nbsp; &lt;/options&gt;<br>


<script type="text/javascript" language="JavaScript">

    *   the alert text if you click "really"
    *   @var    string  s
    var s ="May be _one_disadvantage_ is that you need to escape \n"+
        "'{'  for getting a  '{'\n"+
        "'}'   for getting a  '}'\n"+
        "if those characters are your delimiters\n\n"+
        "i didnt mind it yet...\n";

    *   show an alert text as given in 's'
    *   @version    01/12/10
    function really()


<table border="1">
        <td valign="top">
            If you like :

            [foreach($advantages as $aAdvantage)]

        <td valign="top">
            And you &nbsp; D O N ' T &nbsp; like :

            [foreach($dontLike as $aDontLike)]
then you should try SimpleTemplate.<br><br>


[foreach($disadvantages as $aDisadvantage)]
    no disadvantages registered yet (<a href="javascript:really()">really?</a>)
    , but feel free and mail
    <a href="mailto:hide@address.com">me</a><br>
    <a href="[$viewSourceCodeUrl]">but look at the code first</a><br>
    <a href="[$viewTemplateCodeUrl]">and the template</a><br>
    <a href="[$viewCompiledTemplate]">and the complied template</a><br>
    <a href="[$viewTemplateLog]">template log file</a><br>

<h2>all the currently possible and working xml-options - overview</h2>
 &nbsp; &lt;options&gt;<br>
 &nbsp;  &nbsp; &lt;delimiter begin="\[" end="\]"/&gt;<br>
 &nbsp;  &nbsp; &lt;autoBraces value="true"/&gt;<br>
 &nbsp;  &nbsp; &lt;locale value="en"/&gt;<br>
 &nbsp;  &nbsp; &lt;cache&gt;<br>
 &nbsp;  &nbsp;  &nbsp; &lt;time value="x" unit="week|weeks|day|days|hour|hours|minute|minutes|second"/&gt;<br>
 &nbsp;  &nbsp;  &nbsp; &lt;depends value="$someVar $anotherVar $_nextVar"/&gt;<br>
 &nbsp;  &nbsp; &lt;/cache&gt;<br>
 &nbsp; &lt;/options&gt;<br>

Return current item: PEAR::HTML_Template_Xipe - SimpleTemplate