1
dukeofgami
Problem when I "move" my PHP script
  • 2006/2/20 1:27

  • dukeofgami

  • Just popping in

  • Posts: 9

  • Since: 2005/12/19


Hi, I modified this script in order to see my phpBB2 latest active topics, it works, but when I tell XOOPs to make the start page the news module, i get a fatal error:


Fatal error: Call to a member function getInfo() on a non-object in D:\sokkit\site\include\notification_functions.php on line 95

This is the code:



///////////////////////////////////////////////////////////////////////////////

//                            ACTIVE_TOPICS.PHP

///////////////////////////////////////////////////////////////////////////////

// Copyright:   (C) 2002 Matthijs van de Water 

// Version:     1.1

// Date:        03/02/2002

///////////////////////////////////////////////////////////////////////////////

// Show phpBB 2.0 Active Topics List

// Output format can be any HTML or XML

// This script must be able to access vital phpBB 2.0 configuration scripts

///////////////////////////////////////////////////////////////////////////////



///////////////////////////////////////////////////////////////////////////////

// CUSTOM SETTINGS

///////////////////////////////////////////////////////////////////////////////



// Amount of active topics to show

define("TOPIC_COUNT"20);



// Path to the phpBB 2.0 root directory

define("PHPBB_PATH""foro/");



// URL to the phpBB 2.0 installation

define("PHPBB_LOCATION""http://localhost/foro/");



// Time format to output the date/time (for format see PHP manual)

define("TIME_FORMAT""H:i");



///////////////////////////////////////////////////////////////////////////////



// Includes of phpBB scripts

$phpbb_root_path PHPBB_PATH;

if ( !
defined('IN_PHPBB') ) 

{

  
define('IN_PHPBB'true);

  include(
PHPBB_PATH 'extension.inc');

  include(
PHPBB_PATH 'config.'.$phpEx);

  include(
PHPBB_PATH 'includes/constants.'.$phpEx);

  include(
PHPBB_PATH 'includes/db.'.$phpEx);

}



///////////////////////////////////////////////////////////////////////////////

// HTML header start

///////////////////////////////////////////////////////////////////////////////

?>



  

      Tema

      Vistas

      Respuestas

      Ultima respuesta

    


///////////////////////////////////////////////////////////////////////////////

// HTML header end

///////////////////////////////////////////////////////////////////////////////



// sql statement to fetch active topics of public forums

$sql "SELECT DISTINCT t.topic_title, t.topic_id,t.topic_views,t.topic_replies, t.topic_last_post_id, p.post_time,p.poster_id, f.forum_name, u.user_id, u.username

  FROM " 
TOPICS_TABLE " AS t, " POSTS_TABLE " AS p, " FORUMS_TABLE " AS f, " USERS_TABLE " AS u

  WHERE 

    t.forum_id = f.forum_id 

      AND f.auth_view = " 
AUTH_ALL 

      AND p.topic_id = t.topic_id 

       AND p.poster_id = u.user_id 

      AND p.post_id = t.topic_last_post_id

  ORDER BY p.post_time DESC LIMIT " 
TOPIC_COUNT;

$nt_result $db->sql_query($sql);



if(!
$nt_result)

{

    die(
"Failed obtaining list of active topics".mysql_error());

}

else

{

    
$nt_data $db->sql_fetchrowset();

}

    

if ( 
count($nt_data) == )

{

    die(
"No topics found");

}

else

{

$cq 1;

$cc 333333;

  
// $nt_data contains all interesting data

  
for ($i 0$i count($nt_data); $i++)

  {

    
$title $nt_data[$i]['topic_title'];

    
$Turl PHPBB_LOCATION 'viewtopic.' $phpEx "?t=" $nt_data[$i]['topic_id'];    

    
$LPurl PHPBB_LOCATION 'viewtopic.' $phpEx "?" POST_POST_URL "=" $nt_data[$i]['topic_last_post_id'] . "#" $nt_data[$i]['topic_last_post_id'];

    
$on_forum 'En el foro ' $nt_data[$i]['forum_name'];

    
$post_time date(TIME_FORMAT$nt_data[$i]['post_time']);

    
//Profile profile.php?mode=viewprofile&u=23

    
$profile PHPBB_LOCATION 'profile.' $phpEx "?mode=viewprofile&u=" $nt_data[$i]['poster_id'] ;

    
$usrname $nt_data[$i]['username'];

    

    
// As of now you can actually do anything with the data

    // I chose to output in XML



///////////////////////////////////////////////////////////////////////////////

// Item HTML start

///////////////////////////////////////////////////////////////////////////////

if($cq%== 0){$cc "FFFFFF";$cq++;} else{$cc "CCCCCC";$cq++;}?>

  

    echo $cc;?>" align="left">echo $Turl?>" title="echo $on_forum?>">echo $title?>

    echo $cc;?>" align="left">echo $nt_data[$i]['topic_views'?>


    echo $cc;?>" align="left">echo $nt_data[$i]['topic_replies'?>


    echo $cc;?>" align="left">Por echo $profile?>">echo $usrname?>echo $LPurl?>">echo PHPBB_LOCATION;?>/templates/subSilver/images/icon_latest_reply.gif" border="0" />

    

  


///////////////////////////////////////////////////////////////////////////////

// Item HTML end

///////////////////////////////////////////////////////////////////////////////



  
}

}



///////////////////////////////////////////////////////////////////////////////

// Footer HTML start

///////////////////////////////////////////////////////////////////////////////

?>




///////////////////////////////////////////////////////////////////////////////

// Footer HTML end

///////////////////////////////////////////////////////////////////////////////



// EOF

?>



So I am wondering, how could the code be called as a file? or something like that so it wont conflict with anything?, even if I use the correct path it wont work...

I tried the thing but wont work...

What can I do?

Thanx in advance

2
dukeofgami
Re: Problem when I "move" my PHP script
  • 2006/2/20 14:41

  • dukeofgami

  • Just popping in

  • Posts: 9

  • Since: 2005/12/19


...anyone?

3
dukeofgami
Re: Problem when I "move" my PHP script
  • 2006/2/22 16:03

  • dukeofgami

  • Just popping in

  • Posts: 9

  • Since: 2005/12/19


Ok... I tried an include_once in the block, same thing... anyone please?

4
dukeofgami
Re: Problem when I "move" my PHP script
  • 2006/2/22 21:59

  • dukeofgami

  • Just popping in

  • Posts: 9

  • Since: 2005/12/19


Ok, now I tried several things, I tried moving the script to the modules/news/ folder, it works perfectly as a file, it also works perfectly when included in a block from the default index, but then, when I choose the news module as the start page, i get the same error again.

So I think its got nothing to do with the very location of the script... but a resouce it cant get or something like that from that location, for the script.

Heres line 95 of notification_functions.php


$not_config =& $module->getInfo('notification');



From this function.


function &notificationCategoryInfo ($category_name=''$module_id=null)

{

    if (!isset(
$module_id)) {

        global 
$xoopsModule;

        
$module_id = !empty($xoopsModule) ? $xoopsModule->getVar('mid') : 0;

        
$module =& $xoopsModule;

    } else {

        
$module_handler =& xoops_gethandler('module');

        
$module =& $module_handler->get($module_id);

    }

    
$not_config =& $module->getInfo('notification');

    if (empty(
$category_name)) {

        return 
$not_config['category'];

    }

    foreach (
$not_config['category'] as $category) {

        if (
$category['name'] == $category_name) {

            return 
$category;

        }

    }

    
$ret false;

    return 
$ret;

}




Hope i dont need to core hack...

Could anyone at least say something?? xD

5
dukeofgami
Re: Problem when I "move" my PHP script
  • 2006/2/23 1:09

  • dukeofgami

  • Just popping in

  • Posts: 9

  • Since: 2005/12/19


Ok, I made it work commenting that line # 95... however notifications disappear... so its not a real solution.

How can I get the HTML output of a PHP file?... so I can like just put that HTML in a block. Can it be done?, could anyone help me please?

6
dukeofgami
Re: Problem when I "move" my PHP script
  • 2006/2/23 5:05

  • dukeofgami

  • Just popping in

  • Posts: 9

  • Since: 2005/12/19


HAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAHHAHAHHAHAHAH OMG!!!! I solved it... WITH AN IFRAME!!!! xD... I wasted an entire day to rediscover the iframe, lololol... well, I hope this thread turns useful to someone else xD.

Login

Who's Online

200 user(s) are online (158 user(s) are browsing Support Forums)


Members: 0


Guests: 200


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Jun 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits