Small Contribution
| From: | Rod Kreisler | Date: | Fri, 30 Aug 2002 17:23:20 +0000 |
| Subject: | Small Contribution | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5881@lists.php.net to get a copy of this message | ||
Attached are 2 plugins I wrote based on the html_options plugin.
One creates a table that creates a group of radio button elements and the
other is the same for checkbox elements.
They basically create a table of varying size with one element in each table
cell. The number of cells in each row is controlled by the attribute
"cols", with the rows, obviously, being dynamically determined by "cols" and
the number of elements.
Following is a list of the attributes which are the same for both functions:
options associative array required no default - exactly the same as the
html_options attribute of the same name, where the index is the elements
value attribute and the value is the description
checked multi not required no default - similar to the "selected" attribute
of html_options. Can be an int, string or array relating to the index of
the selected option(s) in the "options" array
cols int not required default=1 - number of cols in each table row
cellpadding int not required no default - the value to set the cellpadding
attribute of the table tag
cellspacing int not required no default - the value to set the cellspacing
attribute of the table tag
border int not required no default - the value to set the border attribute
of the table tag
tableStyle string not required no default - the value to set the style
attribute of the table tag
tableClass string not required no default - the value to set the class
attribute of the table tag
trStyle string not required no default - the value to set the style
attribute of the tr tag
trClass string not required no default - the value to set the class
attribute of the tr tag
trOddStyle string not required no default - the value to set the style
attribute of the tr tag on odd rows
trOddClass string not required no default - the value to set the class
attribute of the tr tag on odd rows
trEvenStyle string not required no default - the value to set the style
attribute of the tr tag on even rows
trEvenClass string not required no default - the value to set the class
attribute of the tr tag on even rows
tdStyle string not required no default - the value to set the style
attribute of the td tag
tdClass string not required no default - the value to set the class
attribute of the td tag
NOTE: the "checked" attribute WILL accept an array of multiple values even
when using html_radio and all matches will be marked 'checked="TRUE"'.
However, due to the nature of HTML only the last element "checked" will
actually be passed.
Also, the various table row attributes have precedence. For example, if you
declare a trStyle and a trOddStyle then all odd rows will use trOddStyle and
even rows will use trStyle (since no trEvenStyle was declared.) If you
declare trStyle, trOddStyle and trEvenStyle, then trStyle will never be used
since all rows will use either trOddStyle or trEvenStyle.
I didn't include all the possible attributes for the various tags since most
can be controlled with a CSS declaration via style or class and didn't think
there would be much call for any other attributes in this situation.
(However, I am thinking about adding style and class arguments for the input
tags themselves but I usually use the same style for all elements in the
form so it would be better declared elsewhere, IMHO.
Rod Kreisler
Attachment: [application/x-compressed] plugins.zip
Attachment: [application/x-compressed] plugins.zip