Question

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>";
    }
Was it helpful?

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

OTHER TIPS

<?php if ($this->getBuffer('message')) : ?>
                  <div class="error">
                     <jdoc:include type="message" />xxxxxxxxxxxx
                  </div>
<?php endif; ?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top