VCL
[ class tree: VCL ] [ index: VCL ] [ all elements ]

Source for file smartytemplate.inc.php

Documentation is available at smartytemplate.inc.php

  1. <?php
  2. /**
  3. *  This file is part of the VCL for PHP project
  4. *
  5. *  Copyright (c) 2004-2007 qadram software <support@qadram.com>
  6. *
  7. *  Checkout AUTHORS file for more information on the developers
  8. *
  9. *  This library is free software; you can redistribute it and/or
  10. *  modify it under the terms of the GNU Lesser General Public
  11. *  License as published by the Free Software Foundation; either
  12. *  version 2.1 of the License, or (at your option) any later version.
  13. *
  14. *  This library is distributed in the hope that it will be useful,
  15. *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17. *  Lesser General Public License for more details.
  18. *
  19. *  You should have received a copy of the GNU Lesser General Public
  20. *  License along with this library; if not, write to the Free Software
  21. *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  22. *  USA
  23. *
  24. */
  25.  
  26. /**
  27.  * SmartyTemplate
  28.  *
  29.  */
  30. class SmartyTemplate extends PageTemplate
  31. {
  32.         public $_smarty=null;
  33.  
  34.         function initialize()
  35.         {
  36.                 require_once("smarty/libs/Smarty.class.php");
  37.  
  38.                 $this->_smarty = new Smarty;
  39.  
  40.                 $this->_smarty->template_dir '';
  41.                 $this->_smarty->compile_dir '/tmp';
  42.         }
  43.  
  44.         function assignComponents()
  45.         {
  46.                 $form=$this->owner;
  47.                 $this->_smarty->assign('HeaderCode'$form->dumpChildrenHeaderCode(true).$form->dumpHeaderJavascript(true));
  48.                 $this->_smarty->assign('StartForm'$form->readStartForm());
  49.                 $this->_smarty->assign('EndForm'$form->readEndForm());                                
  50.  
  51.                 reset($form->controls->items);
  52.                 while (list($k,$v)=each($form->controls->items))
  53.                 {
  54.                         if ($v->Visible)
  55.                         {
  56.                             $this->_smarty->assign($v->Name$v->show(true));
  57.                         }
  58.                 }
  59.         }
  60.  
  61.         function dumpTemplate()
  62.         {
  63.                 $this->_smarty->display($this->FileName);
  64.         }
  65. }
  66.  
  67. //Template registration
  68. global $TemplateManager;
  69. $TemplateManager->registerTemplate('SmartyTemplate','smartytemplate.inc.php');
  70.  
  71. ?>

Documentation generated on Tue, 27 Mar 2007 13:35:21 +0200 by phpDocumentor 1.3.1