本文整理汇总了PHP中fHTML::show方法的典型用法代码示例。如果您正苦于以下问题:PHP fHTML::show方法的具体用法?PHP fHTML::show怎么用?PHP fHTML::show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fHTML
的用法示例。
在下文中一共展示了fHTML::show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Retrieves a message, removes it from the session and prints it - will not print if no content
*
* The message will be printed in a `p` tag if it does not contain
* any block level HTML, otherwise it will be printed in a `div` tag.
*
* @param mixed $name The name or array of names of the message(s) to show, or `'*'` to show all
* @param string $recipient The intended recipient
* @param string $css_class Overrides using the `$name` as the CSS class when displaying the message - only used if a single `$name` is specified
* @return boolean If one or more messages was shown
*/
public static function show($name, $recipient = NULL, $css_class = NULL)
{
if ($recipient === NULL) {
$recipient = '{default}';
}
// Find all messages if * is specified
if (is_string($name) && $name == '*') {
fSession::open();
$prefix = __CLASS__ . '::' . $recipient . '::';
$keys = array_keys($_SESSION);
$name = array();
foreach ($keys as $key) {
if (strpos($key, $prefix) === 0) {
$name[] = substr($key, strlen($prefix));
}
}
}
// Handle showing multiple messages
if (is_array($name)) {
$shown = FALSE;
$names = $name;
foreach ($names as $name) {
$class = trim(self::$class . ' ' . $name);
$class = $css_class === NULL ? $class : $css_class;
$shown = fHTML::show(self::retrieve($name, $recipient), $class, TRUE) || $shown;
}
return $shown;
}
$class = self::$class . ' ' . $name;
$class = $css_class === NULL ? $class : $css_class;
// Handle a single message
return fHTML::show(self::retrieve($name, $recipient), $class, TRUE);
}