本文整理汇总了PHP中Parser::subtext方法的典型用法代码示例。如果您正苦于以下问题:PHP Parser::subtext方法的具体用法?PHP Parser::subtext怎么用?PHP Parser::subtext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parser
的用法示例。
在下文中一共展示了Parser::subtext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doIt
/**
* @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);
}
示例2: subtext
function subtext($name, $data, $pars)
{
return Parser::subtext($data, $pars['length']);
}
示例3: display
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;
}
}
}