Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> NukeSentinel(tm) v2.4.x
Author Message
illestboss
New Member
New Member



Joined: Oct 08, 2005
Posts: 3

PostPosted: Sat Oct 08, 2005 2:48 am Reply with quote

Hello all, I have serached several days, and tried diffrent attempts at what could be the fix. but i am still stuck...


I am trying to install the module webpage56 on my phpnuke 7.7, I have been able to install everything except this module, and im curious if its because of sentinel.

the problem i first was getting was a blank page. then i have turned on error reporting. and this is what i am getting...

Fatal error: Cannot redeclare get_lang() (previously declared in /home/illes2/public_html/mainfile.php:346) in /home/illes2/public_html/mainfile.php on line 363


the code on that line is...



Code:
function get_lang($module) {

    global $currentlang, $language;
    if (file_exists("modules/$module/language/lang-english.php")) {
      if ($module == "admin") {
          include_once("admin/language/lang-english.php");
      } else {
          include_once("modules/$module/language/lang-english.php");
      }
   } else {
      if ($module != "Forums") {
         if ($module == "admin") {
             include_once("admin/language/lang-english.php");
         } else {
             include_once("modules/$module/language/lang-english.php");
         }
      }
    }
}


lang-english was an attempt at a chance from another post i read. the old code is
lang-".$currentlang.".php and i can put it back... but either way i still seem to be stuck.

What other information is needed for any assistance i can get? appreciate the help.
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sat Oct 08, 2005 8:09 am Reply with quote

Nothing to do with NS. You can always verify that NS is or isn't helping out by simply commenting out the include statement in mainfile.php.

A redeclaration error means that the function, in this case get_lang(), is being called twice. PHP does not allow function overloading, which is in essence what is happening. In other words, this is not allowed:

File_1
<?
function get_lang() {
// do stuff;
}
// Maybe other code
?>

File 2
<?
function get_lang() {
// do stuff;
}
include('File_1');
?>

That would cause a redeclaration error. What you can do to circumvent that type of an error is to check to see if the function already exists, like this.
File_1
<?
if (!function_exists('get_lang')) {
function get_lang() {
// do stuff;
}
}
// Maybe other code
?>
 
View user's profile Send private message
illestboss







PostPosted: Sat Oct 08, 2005 1:42 pm Reply with quote

Excellent. Inside the Index.php for the webpage module i did the following....

original code:

Code:
if (!isset($mainfile)) { include("mainfile.php"); }



Commented out // { include( as follows

Code:
if (!isset($mainfile)) //{ include("mainfile.php"); }



So far this seems to have worked.

Thank you for such a easy fix. Would have saved me mucho time if i had asked before hand =D

Raven you rock bro.
 
Raven







PostPosted: Sat Oct 08, 2005 2:35 pm Reply with quote

Try this instead:

if (!isset($mainfile)) { include_once("mainfile.php"); }
 
illestboss







PostPosted: Sat Oct 08, 2005 2:37 pm Reply with quote

I had actually tried that the other day, and it did nothing. to make any changes, soon as i commented out the mainfile.php it started right up.

Will i encounter errors with that being commented out?
 
Raven







PostPosted: Sat Oct 08, 2005 2:42 pm Reply with quote

Depends why it's in there at all. If that does not work then that says that $mainfile is not being set. That's the first question to answer. Should it be? Try this

include_once("mainfile.php");
 
Raven







PostPosted: Sat Oct 08, 2005 2:44 pm Reply with quote

Whoops. I hit submit instead of review. I was going to go on to say that if it causes the error still, which it probably will, then you need to determine why mainfile.php is being called at all if it's already loaded.
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> NukeSentinel(tm) v2.4.x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©