Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何格式化Joomla错误消息_Php_Joomla_Joomla3.1 - Fatal编程技术网

Php 如何格式化Joomla错误消息

Php 如何格式化Joomla错误消息,php,joomla,joomla3.1,Php,Joomla,Joomla3.1,当某人的登录详细信息不正确时,我想在Joomla 3.1中显示一条错误消息。当代码输出错误时,我需要IF语句来应用某些样式 // System Error Message if ($this->getBuffer('message')) { $systemerror = $this->getBuffer('message'); $error = "yes"; } if($error="yes") { echo "<span

当某人的登录详细信息不正确时,我想在Joomla 3.1中显示一条错误消息。当代码输出错误时,我需要IF语句来应用某些样式

    // System Error Message
    if ($this->getBuffer('message')) {
    $systemerror = $this->getBuffer('message');
    $error = "yes";
    }
    if($error="yes") {
    echo "<span class='error'>$systemerror</span>";
    }

这似乎无法完成,因为下面的代码仍然呈现HTML元素,它们只是空的

<jdoc:include type="message" />
因此,解决方案是纯粹使用Joomla生成的类。这并不理想,对我来说,这意味着在我的模板中做同样的事情两次。作为参考,输出的代码为:

<div id="system-message-container">

<div id="system-message">
    <div class="alert alert-warning">
        <a class="close" data-dismiss="alert"> [cross to close] </a>
        <h4 class="alert-heading"> [heading] </h4>
        <div> [message] </div>
    </div>
</div>
<div id="system-message-container">

<div id="system-message">
    <div class="alert alert-warning">
        <a class="close" data-dismiss="alert"> [cross to close] </a>
        <h4 class="alert-heading"> [heading] </h4>
        <div> [message] </div>
    </div>
</div>