Errors what do i do?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Errors what do i do?

Post by gaogier »

i have looked in my php book, spoono and they dont help

Fatal error: Cannot instantiate non-existent class: cash_menucat in /home/gaogier/public_html/forums/admin/admin_cash.php on line 32

the code

Code: Select all

<?php
/***************************************************************************
 *                              admin_cash.php
 *                            -------------------
 *   begin                : Monday, Aug 18, 2003
 *   copyright            : (C) 2003 Xore
 *   email                : mods@xore.ca
 *
 *   $Id: admin_cash.php,v 1.1.0.0 2003/09/18 23:03:34 Xore $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

if ( !defined('ADMIN_MENU') )
{
	define('ADMIN_MENU',1);
	function admin_menu(&$menu)
	{
		global $lang;
		$i = 0;
		$j = 0;
		
$menu[$i] = new cash_menucat($lang['Cmcat_main']);
		$menu[$i]->additem(new cash_menuitem($j,	'Cash_Configuration',	'cash_config',		$lang['Cmenu_cash_config']));
		$menu[$i]->additem(new cash_menuitem($j,	'Cash_Currencies',		'cash_currencies',	$lang['Cmenu_cash_currencies']));
		$menu[$i]->additem(new cash_menuitem($j,	'Cash_Forums',			'cash_forums',		$lang['Cmenu_cash_forums']));
		$menu[$i]->additem(new cash_menuitem($j,	'Cash_Settings',		'cash_settings',	$lang['Cmenu_cash_settings']));
		$i++;
		$menu[$i] = new cash_menucat($lang['Cmcat_addons']);
		$menu[$i]->additem(new cash_menuitem($j,	'Cash_Events',			'cash_events',		$lang['Cmenu_cash_events']));
		$menu[$i]->additem(new cash_menuitem($j,	'Cash_Reset',			'cash_reset',		$lang['Cmenu_cash_reset']));
		$i++;
		$menu[$i] = new cash_menucat($lang['Cmcat_other']);
		$menu[$i]->additem(new cash_menuitem($j,	'Cash_Exchange',		'cash_exchange',	$lang['Cmenu_cash_exchange']));
		$menu[$i]->additem(new cash_menuitem($j,	'Cash_Groups',			'cash_groups',		$lang['Cmenu_cash_groups']));
		$menu[$i]->additem(new cash_menuitem($j,	'Cash_Logs',			'cash_log',			$lang['Cmenu_cash_log']));
		$i++;
		$menu[$i] = new cash_menucat($lang['Cmcat_help']);
		$menu[$i]->additem(new cash_menuitem($j,	'Cash_Help',			'cash_help',		$lang['Cmenu_cash_help']));
	}
}
their are loads of these errors since i updated the forums

please help

btw the book is called "php and mysql for dynamic websites"
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

the error purely means that a class definition for 'cash_menucat' wasn't included at run-time. So you must have a file laying around that has this class definition in it.. make sure it's included in the main admin file (I guess)
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

this is due to me updating the forums
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

how do i find out what the line of code is without counting them all?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it's easier to use an editor with line numbering.. (they have been discussed a lot in the "favorite editors" thread in the general forum)
User avatar
shoebappa
Forum Contributor
Posts: 158
Joined: Mon Jul 11, 2005 9:14 pm
Location: Norfolk, VA

Post by shoebappa »

Who needs fancy editors... In Notepad, make sure Word Wrap is off under Format. Then under Edit, there's a GoTo option that lets you enter a line number.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

shoebappa wrote:Who needs fancy editors... In Notepad, make sure Word Wrap is off under Format. Then under Edit, there's a GoTo option that lets you enter a line number.
Notepad is an editor and also discussed in that thread. Let's try to keep this thread on-topic ;)
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

any ideas on what i need to do?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You need to find which file contains the class and then include() or require() it before it's instantiated with $classname = new classname(); ;)

It's way too vague for us to be more specific than that because you'll have lots of files and we wont know whats in them all.
gaogier
Forum Contributor
Posts: 391
Joined: Wed Mar 02, 2005 1:02 pm
Location: Portsmouth, UK
Contact:

Post by gaogier »

i dont understand
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

figure .. out .. which .. file .. the .. class .. is .. defined .. in.
include() .. it .. in .. a .. central .. location.

last time I try this..... :?
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

A class is a blueprint. PHP becomes aware of this blueprint during a script when the file the blueprint is included is "included" into the script. If the page with the blueprint is never included, then PHP does not have a blueprint, so it cannot create the class ("the structure the blueprint describes"). Therefore, you must makesure PHP has the blueprint.
Post Reply