cvs: smarty / QUICK_START /libs/plugins function.html_radios.php

"Monte Ohrt" <[email protected]>
Newsgroups gmane.comp.php.cvs.smarty
Message-ID <cvsmohrt1109255868@cvsserver>
mohrt		Thu Feb 24 09:37:48 2005 EDT

  Modified files:              
    /smarty	QUICK_START 
    /smarty/libs/plugins	function.html_radios.php 
  Log:
  add label ids to html_radios
  
  
http://cvs.php.net/diff.php/smarty/QUICK_START?r1=1.4&r2=1.5&ty=u
Index: smarty/QUICK_START
diff -u smarty/QUICK_START:1.4 smarty/QUICK_START:1.5
--- smarty/QUICK_START:1.4	Thu Feb 10 15:14:55 2005
+++ smarty/QUICK_START	Thu Feb 24 09:37:47 2005
@@ -9,6 +9,7 @@
 Copy the Smarty library files to your system. In our example, we place them in
 /usr/local/lib/php/Smarty/
 
+$> cd YOUR_DOWNLOAD_DIRECTORY
 $> gtar -ztvf Smarty-2.6.7.tar.gz
 $> mkdir /usr/local/lib/php/Smarty
 $> cp -r Smarty-2.6.7/libs/* /usr/local/lib/php/Smarty
http://cvs.php.net/diff.php/smarty/libs/plugins/function.html_radios.php?r1=1.24&r2=1.25&ty=u
Index: smarty/libs/plugins/function.html_radios.php
diff -u smarty/libs/plugins/function.html_radios.php:1.24 smarty/libs/plugins/function.html_radios.php:1.25
--- smarty/libs/plugins/function.html_radios.php:1.24	Fri Feb  4 16:29:06 2005
+++ smarty/libs/plugins/function.html_radios.php	Thu Feb 24 09:37:48 2005
@@ -127,11 +127,16 @@
 
 function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels) {
     $_output = '';
-    if ($labels) $_output .= '<label>';
-    $_output .= '<input type="radio" name="'
+    if ($labels) {
+      $_id = smarty_function_escape_special_chars($name . '_' . $value);
+      $_output .= '<label for="' . $_id . '">';
+   }
+   $_output .= '<input type="radio" name="'
         . smarty_function_escape_special_chars($name) . '" value="'
         . smarty_function_escape_special_chars($value) . '"';
 
+   if ($labels) $_output .= ' id="' . $_id . '"';
+
     if ($value==$selected) {
         $_output .= ' checked="checked"';
     }

-- 
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.