Author Topic: vLIB basic example  (Read 1720 times)

0 Members and 1 Guest are viewing this topic.

Offline ClausVB

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
    • Homepage: clausvb.de
vLIB basic example
on: Wed, 28. March 2007 - 15:29:15
http://lamp.clausvb.de/vlib_examples/basic.php

Code: [Select]
<?php
    
if (php == $_GET[showsource])
    {
        
show_source($_SERVER[SCRIPT_FILENAME]);
        exit;
    }
    elseif (
html == $_GET[showsource])
    {
        
show_source(dirname(__FILE__) . /tmpl/basic.htm);
        exit;
    }


    require_once 
vlib/vlibTemplate.php;

    
$tmpl = new vlibTemplate(tmpl/basic.htm);

    
$tmpl->setvar(title_textTITLE: This is the vLIB basic example ...);
    
$tmpl->setvar(body_textBODY: This is the message set using setvar());

    
$tmpl->pparse();
?>

Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
   <title>{tmpl_var name=title_text}</title>
   <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
</head>

<body>

<p>{tmpl_var name=body_text}</p>

<p><a href="basic.php?showsource=php">show PHP code</a> |
<a href="basic.php?showsource=html">show template (HTML code)</a></p>

</body>
</html>