PDA

View Full Version : Two scripts on one page



Pecnut
08-21-2005, 06:15 AM
When I try to put 2 scripts on one page, I get an error on the second script, which worked fine by itself:

Fatal error: Cannot redeclare class ep_dev_forum_news in /home/pecnut/public_html/forums/forum-news/news.php on line 26
How can I tweak the script to allow 2 EP-Dev Forum News scripts to work on the same page?

I am using the script on a .html page, with PHP enabled through a Frontpage extension.

Pecnut
08-21-2005, 06:39 AM
Actually, I've managed to solve the problem myself.

For anyone else with a similar problem, use the SAME epdev module and configure 2 different news sources. That's what's fixed mine.

Patrick
08-21-2005, 11:11 AM
Actually, I've managed to solve the problem myself.

For anyone else with a similar problem, use the SAME epdev module and configure 2 different news sources. That's what's fixed mine.
Exactly. This is preferred.

For anyone who has this problem in the future:

For anyone who still wants to use two different installs on the same page, simply remove the include_once("/abs/path/to/news.php"); from the generated code.

Still, the preferred method would be to use the same news object, like:

<?php include_once("/abs/path/to/news.php");
$forum_obj = new EP_Dev_Forum_News();
$forum_obj->display_News("", "1", "0", "0"); ?>
for the first one, and then just:


<?php $forum_obj->display_News("", "1", "1", "0"); ?>
For the second one (further down the page as far as source code goes).