PHP Classes

File: plugins/html_radioboxes/plugin.php

Recommend this page to a friend!
  Classes of P. Krijnberg   Expose template engine   plugins/html_radioboxes/plugin.php   Download  
File: plugins/html_radioboxes/plugin.php
Role: Auxiliary script
Content type: text/plain
Description: Radioboxes
Class: Expose template engine
Template compiler engine extensible with plug-ins
Author: By
Last change: role
Date: 18 years ago
Size: 931 bytes
 

Contents

Class file image Download
<?php
function expose_plugin_html_radioboxes( & $expose, $params )
{
   
$params = exposeMergeParameters( $params, array(
       
'name' => '',
       
'options' => array(),
       
'selected' => '',
       
'attr' => '',
       
'separator' => ''
   
) );
   
   
$params['options'] = exposeReadArray( $params['options'] );
   
$count = count( $params['options'] );
   
$i = 0;
   
    foreach(
$params['options'] as $key => $value ) {
        if(
is_array( $value ) ) {
           
$key = $value[0];
           
$value = $value[1];
        }
       
$checkState = ( (string) $key == (string) $params['selected'] ) ? 'checked="checked"' : '';
        echo(
"<label><input name=\"{$params['name']}\" value=\"$key\" type=\"radio\" {$params['attr']} $checkState/>$value</label>" );
       
        if( ++
$i < $count ) {
            echo(
$params['separator'] );
        }
    }
}
?>