/** * Smarty {variablebox_content} plugin * * Type: function<br> * Name: variablebox_content<br> * Purpose: Creates divission in a {variablebox} * @param array * </pre> * @author Egil Möller <*****@*****.**> * @param any params (none!) * @param Smarty clever simulation of a method * @return string divider code */ function smarty_function_variablebox_content($params, &$smarty) { $boxparams =& smarty_find_tag($smarty, 'variablebox'); if ($boxparams === null) { throw new Exception('Unable to find parent variablebox for variablebox_content'); } $res = "</td>"; if ($boxparams['border_right'] == 'shown') { $res .= "<td class='variablebox_center_right'></td>"; } $boxparams['content_count'] += 1; $res .= "</tr><tr class='content_{$boxparams['content_count']}'>"; if ($boxparams['border_left'] == 'shown') { $res .= "<td class='variablebox_middle_left'></td>"; } $res .= "<td class='variablebox_middle_center'></td>"; if ($boxparams['border_right'] == 'shown') { $res .= "<td class='variablebox_middle_right'></td>"; } $boxparams['content_count'] += 1; $res .= "</tr><tr class='content_{$boxparams['content_count']}'>"; if ($boxparams['border_left'] == 'shown') { $res .= "<td class='variablebox_center_left'></td>"; } $res .= "<td class='variablebox_center_center'>"; return $res; }
/** * Smarty {variablebox}{/variablebox} block plugin * * Type: block function<br> * Name: variablebox<br> * Purpose: Creates a stylable table box around content<br> * @param array * <pre> * Params: class: string (class) * </pre> * @author Egil Möller <*****@*****.**> * @param string contents of the block * @param Smarty clever simulation of a method * @param repeat signal * @return string string $content re-formatted */ function smarty_block_variablebox($params, $content, &$smarty, &$repeat) { if (is_null($content)) { return; } $boxparams =& smarty_find_tag($smarty, 'variablebox'); $res = "<table class='variablebox product_type_article centre_column_content {$boxparams['class']}'>"; if ($boxparams['border_top'] == "shown") { $res .= "<tr class='content_0'>"; if ($boxparams['border_left'] == "shown") { $res .= "<td class='variablebox_top_left'></td>"; } $res .= "<td class='variablebox_top_center'></td>"; if ($boxparams['border_right'] == "shown") { $res .= "<td class='variablebox_top_right'></td>"; } $res .= "</tr>"; } $res .= "<tr class='content_1'>"; if ($boxparams['border_left'] == "shown") { $res .= "<td class='variablebox_center_left'></td>"; } $res .= "<td class='variablebox_center_center'>{$content}</td>"; if ($boxparams['border_right'] == "shown") { $res .= "<td class='variablebox_center_right'></td>"; } $res .= "</tr>"; $boxparams['content_count'] += 1; if ($boxparams['border_bottom'] == "shown") { $res .= "<tr class='content_{$boxparams['content_count']}'>"; if ($boxparams['border_left'] == "shown") { $res .= "<td class='variablebox_bottom_left'></td>"; } $res .= "<td class='variablebox_bottom_center'></td>"; if ($boxparams['border_right'] == "shown") { $res .= "<td class='variablebox_bottom_right'></td>"; } $res .= "</tr>"; } $res .= "</table>"; return $res; }