Book Image

concrete5 Beginner's Guide

Book Image

concrete5 Beginner's Guide

Overview of this book

Table of Contents (19 chapters)
concrete5
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – adding variables to handle login errors


Carry out the following steps:

  1. Before you put any code in view.php, open concrete\themes\core\concrete.php and have a look at the content of the file. Right before $innerContent is printed there are a few lines about printing any existing errors. This is what we're going to need in our view.php too. Copy and insert it in the new file, and it should look like the following:

    <?php
    defined('C5_EXECUTE') or die(_("Access Denied."));
    $this->inc('elements/header.php');
    ?>
    
    <div id="content">
    
    <?php  if (isset($error) && $error != '') { ?>
    <?php
    if ($error instanceof Exception) {
    $_error[] = $error->getMessage();
    } else if ($error instanceofValidationErrorHelper) { 
    $_error = $error->getList();
    } else if (is_array($error)) {
    $_error = $error;
    } else if (is_string($error)) {
    $_error[] = $error;
    }
    ?>
    <ul class="ccm-error">
    <?php foreach($_error as $e) { ?><li><?php echo $e?>...