jlamorey Posted April 20, 2012 Report Share Posted April 20, 2012 Hi There, I'm following the oop cms tutorial and am trying to get the login/logout working before I go any further. The error I get is 'Fatal error: Call to undefined function getAlerts() in /Applications/MAMP/htdocs/login/views/v_login.php on line 16' Line 16 of v_login is: <?php $alerts = $this->getAlerts(); if ($alerts != '') { echo '<ul class="alerts">' . $alerts . '</ul>'; } ?> In the m_templates file the getAlerts function had alerts as alert, so I changed that and the error msg in netbeans went away, but my browser is still giving me the error. Curious if anyone has run into this. Jessica Quote Link to comment Share on other sites More sharing options...
falkencreative Posted April 20, 2012 Report Share Posted April 20, 2012 I'm pretty sure you've mistyped something in your code, since I know quite a few people have done this course and not had any issues. Can you post the code you have within m_templates.php so I can take a look? Quote Link to comment Share on other sites More sharing options...
jlamorey Posted April 20, 2012 Author Report Share Posted April 20, 2012 here is the m_templates - and thanks for the speedy reply! <?php /* Template Class Handles all templating tasks - displaying templates, alerts & errors */ class Template { private $data; private $alertTypes; /* Construtor */ function __construct() {} /* Functions */ function load($url) { include($url); } function redirect($url) { header("Location: $url"); } /* Get / Set Data */ function setData($name, $value) { $this->data[$name] = htmlentities($value, ENT_QUOTES); } function getData($name) { if (isset($this->data[$name])) { return $this->data[$name]; } else { return ''; } } /* Get / Set Alerts */ function setAlertTypes($types) { $this->alertTypes = $types; } function setAlert($value, $type = null) { if ($type == '') { $type = $this->alertTypes[0]; } $_SESSION[$type][] = $value; } function getAlerts() { $data = ''; foreach($this->alertTypes as $alerts) { if (isset($_SESSION[$alerts])) { foreach($_SESSION[$alerts] as $value) { $data .= '<li class="'. $alerts .'">' . $value . '</li>'; } unset($_SESSION[$alerts]); } } return $data; } } Quote Link to comment Share on other sites More sharing options...
jlamorey Posted April 20, 2012 Author Report Share Posted April 20, 2012 duplicate post Quote Link to comment Share on other sites More sharing options...
falkencreative Posted April 20, 2012 Report Share Posted April 20, 2012 How is "v_login.php" being loaded? Through the template object's load() function, right? It might just be faster for you to zip your files up and email them to me (ben@killersites.com) and I can take a look. Quote Link to comment Share on other sites More sharing options...
jlamorey Posted April 20, 2012 Author Report Share Posted April 20, 2012 great, thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.