Revision: 25328
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 27, 2010 12:37 by paramah
Initial Code
function smarty_function_makelink ($params, $smarty) { if(!is_array($smarty->tpl_vars['acces_sites']->value)) { throw new Exception ("makelink: param 'access_sites' not assigned"); return; } if (empty($params['link'])) { throw new Exception ("makelink: param 'link' not defined"); return; } if (isset($params['type'])) $type = $params['type']; else $type = 'action'; $link = $params['link']; if (isset($params['name'])) $name = $params['name']; else $name = $link; if($smarty->tpl_vars['acces_sites']->value[$link] == '1') { $data = explode("_", $link); $return = '<a href="'.$smarty->tpl_vars['webroot']->value.'/'.$data[0].'/'.$data[1].'/'.$data[2].'" class="ektab '; $act = $smarty->tpl_vars['params']->value; switch ($type) { case 'action': $alink = $act['module']."_".$act['controller']."_".$act['action']; break; case 'controller': $alink = $act['module']."_".$act['controller'].'_index'; break; case 'module': $alink = $act['module']; break; } if($link == $alink) $return .= 'active '; $return .= '">'.$name.'</a>'; return $return; } }
Initial URL
Initial Description
Initial Title
Smarty makelink function
Initial Tags
php, textmate
Initial Language
Other