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
forgun
Forum Commoner
Posts: 61 Joined: Wed Jan 29, 2003 6:05 am
Contact:
Post
by forgun » Sat Jul 05, 2003 3:31 pm
the error
Code: Select all
Fatal error: Cannot redeclare class func in /home/virtual/site3/fst/var/www/html/il-pc/includes/functions.php on line 2
the cone on that line is
Code: Select all
<?php
class func extends mysql {
var $dt;
function s_title($loc) {
switch ($loc) {
case "update":
$this->dt = array (
'title' => "UpDate Web Site" ,
'js' => "./includes/bbcode.js"
);
break;
case "menu":
$this->dt = array (
'title' => "UpDate Menu Web Site"
);
break;
case "vote":
$this->dt = array (
'title' => "UpDate Vote System"
);
break;
case "games":
$this->dt = array (
'title' => "UpDate Games Settings"
);
break;
case "settings":
$this->dt = array (
'title' => "UpDate Main Setiings Web Site"
);
break;
}
}
}
?>
why????
here the plave that active the command
Code: Select all
<?php
include ("./includes/functions.php");
$st = new func();
$st->s_title($loc);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<SCRIPT src="<?= $st->dt['js'] ?>" language="javascript"></SCRIPT>
<title>IL-Vortex - PC ( <?= $st->dt['title'] ?> )</title>plz help me
forgun
Forum Commoner
Posts: 61 Joined: Wed Jan 29, 2003 6:05 am
Contact:
Post
by forgun » Sat Jul 05, 2003 4:00 pm
mm yap
more two
i dont have
php 5.0
i have 4.3+
m@ndio
Forum Regular
Posts: 163 Joined: Fri Jun 06, 2003 12:09 pm
Location: UK
Post
by m@ndio » Sun Jul 06, 2003 4:07 am
I think func is a reserved keyword by PHP. Try changing it to something like eggandchips and see if that works if that does then try and call it something that will not be repeated like func_class or something.
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Mon Jul 07, 2003 3:32 am
Also, when including class or function files, use include_once() or require_once() so that they aren't reincluded if they've already been included.
Mac
cactus
Forum Regular
Posts: 343 Joined: Tue Jun 10, 2003 4:16 am
Location: UK
Post
by cactus » Mon Jul 07, 2003 6:23 am
If your still having an issue, this is a useful method to check which classes have been declared in your script:
syntax : array get_declared_classes ( void )
Ref :
http://uk.php.net/get_declared_classes
Regards,