Login   Register  
PHP Classes
elePHPant
Icontem

File: plugins/html_selectbox/plugin.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of P. Krijnberg  >  Expose template engine  >  plugins/html_selectbox/plugin.php  >  Download  
File: plugins/html_selectbox/plugin.php
Role: Auxiliary script
Content type: text/plain
Description: Selectbox plugin
Class: Expose template engine
Template compiler engine extensible with plug-ins
Author: By
Last change: role
Date: 2006-02-11 06:22
Size: 826 bytes
 

Contents

Class file image Download
<?php
function expose_plugin_html_selectbox( & $expose$params )
{
    
$params exposeMergeParameters$params, array(
        
'name'      => '',
        
'options'   => array(),
        
'selected'  => '',
        
'attr'      => ''
    
) );

    
$params['options'] = exposeReadArray$params['options'] );
   
    echo( 
"<select name=\"{$params['name']}\" {$params['attr']}>\n" );
    foreach( 
$params['options'] as $key => $text )
    {
        if( 
is_array$text ) ) {
            
$key $text[0];
            
$text $text[1];
        }
        
        
$selectState = ( (string) $params['selected'] == (string) $key ) ? 'selected="selected"' '';
        echo( 
"<option value=\"".htmlentities($key)."\" $selectState>".htmlentities($text)."</option>\n" );
    }
    echo( 
"</select>\n" );
}
?>