其他类型消息和message类型消息显示式样是一样的。假若想仅使用bespoke消息样式来格式化其他消息样式而不显示。这在用作调试时非常有用。
下面例子演示了如何给页面增加CSS样式,并通过前面所讲的method调用方式,来修改bespoke类型消息的显示样式。
$css = '/* Bespoke Error Messages */
#system-message dt.bespoke
{
display: none;
}
dl#system-message dd.bespoke ul
{
color: #30A427;
border-top: 3px solid #94CA8D;
border-bottom: 3px solid #94CA8D;
background: #C8DEC7 url(notice-bespoke.png) 4px 4px no-repeat;
}';
//给$css变量赋于样式的字符串
$doc =& JFactory::getDocument();
$doc->addStyleDeclaration($css);
//给当前文档页面增加该部分css
Now when bespoke messages are rendered, they will appear like this:
现在bespoke类型消息显示样式被改变,显示如下。
图略244