PHP Classes

File: function.auriumform_config.php

Recommend this page to a friend!
  Classes of Alfred R. Baudisch   AuriumForm   function.auriumform_config.php   Download  
File: function.auriumform_config.php
Role: Auxiliary script
Content type: text/plain
Description: Another plugin for Smarty and AuriumForm integration
Class: AuriumForm
Validate and output forms using HTML or Smarty
Author: By
Last change:
Date: 19 years ago
Size: 1,998 bytes
 

Contents

Class file image Download
<?php

/**
 * AuriumForm Smarty Integration
 *
 * Function: To create AuriumForm class and set the template for the fields and
 * others configurations
 *
 * usage:
 * {auriumform_config open='' label='' field='' error='' close='' line='' field_one=''}
 * optional: css, size and css_error
 *
 * Use |LABEL|, |FIELD| and |ERROR| in the appropiate template places.
 * See more on AuriumForm class file.
 *
 * You can call this function in the same file how many times you need.
 *
 * @since Feb 17, 2005
 * @author Alfred Reinold Baudisch <alfred@auriumsoft.com.br>
 */
function smarty_function_auriumform_config($params, &$smarty)
{
    if(!
class_exists('AuriumForm'))
    {
        require_once
'auriumform/class.auriumform.php';
    }
   
   
/**
     * Set class attributes
     */
   
$Config = array();

    if(
$params['css'] && is_object($smarty->_AuriumForm))
    {
       
$smarty->_AuriumForm->SetConfig(array('css' => $params['css']));
    }
    elseif(
$params['css'])
    {
       
$Config['css'] = $params['css'];
    }

    if(
$params['css_error'] && is_object($smarty->_AuriumForm))
    {
       
$smarty->_AuriumForm->SetConfig(array('css_error' => $params['css_error']));
    }
    elseif(
$params['css_error'])
    {
       
$Config['css_error'] = $params['css_error'];
    }

    if(
$params['size'] && is_object($smarty->_AuriumForm))
    {
       
$smarty->_AuriumForm->SetConfig(array('size' => $params['size']));
       
    }
    elseif(
$params['size'])
    {
       
$Config['size'] = $params['size'];
    }

    if(!
is_object($smarty->_AuriumForm))
    {
       
$smarty->_AuriumForm =& new AuriumForm($Config);
    }
   
   
/**
     * Set class template
     */
   
$Template = array();

    foreach(
$params as $_key => $_val)
    {
       
$Template['template_' . $_key] = $_val;
    }

    if(
sizeof($Template))
    {
       
$smarty->_AuriumForm->SetTemplate($Template);
    }
}

?>