/** * @access public * @param aExtrinsicState * @ParamType aExtrinsicState */ public function doIt($tagRoute, $parameters) { $length_default = 50; /* * Inseriamo un default nel caso non venga esplicitata la length del taglio, * ovvero nel caso in cui venga passata SOLO la stringa da tagliare. */ if (!isset($parameters[1])) { $length = $length_default; $string_to_cut = $parameters[0]; } else { $length = $parameters[1]; $string_to_cut = $parameters[0]; } /* * $parameters in questo caso � un array di 2 elementi * $paremeters[0] ha la stringa in input da tagliare; * $parameters[1] ha la quantit�, la length del taglio. */ return Parser::subtext($string_to_cut, $length); }
function subtext($name, $data, $pars) { return Parser::subtext($data, $pars['length']); }
function display($data) { $length = 400; foreach ($data as $k => $v) { switch ($k) { case "body": $this->template->setContent($k, Parser::subtext($data[$k], $length) . " ..."); break; case "video": if ($data[$k] != "") { #$this->template->setContent("video","<span class=\"mediaicons\"><img src=\"img/grafica/icon_video.gif\" alt=\"Video: titolo_mainnews\"/><a href=\"javascript:openvideo('{$data['video']}','{$data['logo']}')\">video </a> </span>"); $this->template->setContent("video", "<img src=\"img/grafica/icon_video.gif\" alt=\"Video: titolo_mainnews\"/><a href=\"javascript:openvideo('{$data['video']}','{$data['logo']}')\">video </a>"); } else { $this->template->setContent("video", ""); } break; case "foto": if ($data[$k] != 0) { $length = 250; $this->template->setContent("foto", "<a href=\"news.php?id={$data['id']}\"><img src=\"show.php?token=3bcda8f2aed2c8f1fdea1c020dadcf39&id={$data['id']}&width=52&height=60&thumb\" alt=\"{$data['title']}\"/></a>"); } else { $this->template->setContent("foto", ""); } break; case "data": $this->template->setContent("data", Parser::formatDate($v, STANDARD_PLUS)); break; default: $this->template->setContent($k, $data[$k]); break; } } }