Jump to content

php login error msg


jlamorey

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...