문제

I want to show an error message in Joomla 3.1 when someone's login details aren't correct. While the code outputs the error, I need the IF statement to work to apply certain styling.

    // System Error Message
    if ($this->getBuffer('message')) {
    $systemerror = $this->getBuffer('message');
    $error = "yes";
    }
    if($error="yes") {
    echo "<span class='error'>$systemerror</span>";
    }
도움이 되었습니까?

해결책 2

It appears this can't be done, because the code below still renders HTML elements, they are just empty.

<jdoc:include type="message" />

The solution is therefor to purely use the classes generated by Joomla. It is not ideal, and for me has meant doing the same thing twice in my template. For reference the code that is outputted is:

<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>

다른 팁

<?php if ($this->getBuffer('message')) : ?>
                  <div class="error">
                     <jdoc:include type="message" />xxxxxxxxxxxx
                  </div>
<?php endif; ?>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top