===== Column Action =====
>>**See Also**
~- tbd
>>//NOT Included in any Wikka version yet//{{lastedit}}
==What==
~- A way to print text in columns via
tags.
==Use==
~- Start the column by calling the col action with an parameter, stop the col by calling col by it's own.
~~""{{col class="floatr"}}This is the same as putting the text in >> tags{{col}}""
~~""{{col left="DIV"}}{{col left="33"}}First column{{col}}{{col left="34"}}Middle column{{col}}{{col left="33"}}Last column{{col}}{{col}}""
==Parameters==
~""
name | type | required? | default | description |
id | string | optional | empty | Define the id of this column. |
class | string | optional | empty | Define the class of this column. |
left | (pos) integer | optional | empty | Width + left alignment |
right | (pos) integer | optional | empty | Width + right alignment |
""
==Features==
~- If no param is send, a closing
is returned.
~- Left and right params can't be used in the same call, left has priority in this case.
~- Left and right dimensions are percentages when smaller then 100, px when bigger. (if you need to add a column with a width of 80px you'll need to alter this in the code)
~- If an empty param or wrong format is used, a clean is retured, this would be a good idea to wrap this around your columns if you plan on using the full width of the page. (Looks nicer with the text above/below.)
~- **W A R N I N G**: by not closing tags,... is it realy easy to mix up you current css layout...
==Installation==
~- Save the code below as ##action/col.php##
~- Give it the same file permissions as the other php files in that directory.
==Code==
~%%(php) columns
// by OnegWR, may 2005, License GPL
$col_id=$col_class=$col_left=$col_right="";
if(is_array($vars) AND $vars <> array() ){
if(isset($vars['id'])){
$col_id = preg_replace("%[^A-Za-z0-9]%", "", $vars['id']);
if( $col_id <> '' ){ $col_id = " id=\"$col_id\""; }
}
if(isset($vars['class'])){
$col_class = preg_replace("%[^A-Za-z0-9]%", "", $vars['class']);
if( $col_class <> '' ){ $col_class = " class=\"$col_class\""; }
}
if(($col_id=='') AND ($col_class=='')){
if(isset($vars['left'])){
$col_left = preg_replace("%[^0-9]%", "", $vars['left']);
if( $col_left <> '' ){
$col_left>100 ? $col_left=" style=\"width: $col_left; float: left;\"" : $col_left=" style=\"width: $col_left%; float: left;\"";
}
}elseif(isset($vars['right'])){
$col_right = preg_replace("%[^0-9]%", "", $vars['right']);
if( $col_right <> '' ){
$col_right>100 ? $col_left=" style=\"width: $col_right; float: right;\"" : $col_right=" style=\"width: $col_right%; float: right
;\"";
}
}
}
print "
";
}else{
print "
";
}
?>
%%
==Demo==
~- ""{{col left="DIV"}}{{col left="33"}}First column{{col}}{{col left="34"}}Middle column{{col}}{{col left="33"}}Last column{{col}}{{col}}""
~""
First column
Middle column
Last column
""
==History==
~- Published on main site (2005-05-09) - OnegWR
==To Do==
~- Add code for text alignment.
----
CategoryUserContributions