make_jumpbox

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
DanielT
Former Team Member
Posts: 3324
Joined: Tue Aug 27, 2002 10:55 am
Contact:

make_jumpbox

Post by DanielT »

hey,

im using this;

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$forum_id = "1";
$jump = make_jumpbox('viewforum.'.$phpEx, $forum_id);
echo $jump
?>

and i get this;

Fatal error: Call to a member function on a non-object in includes\functions.php on line 182
line ~182 wrote: $template->set_filenames(array(
'jumpbox' => 'jumpbox.tpl')
);


any ideas?

thanks
sj26
Registered User
Posts: 447
Joined: Fri Dec 14, 2001 4:06 pm
Location: /dev/cpu/[0-9]+ :D
Contact:

Post by sj26 »

the session initialisation functions instantiate the template object, so

Code: Select all

<?php 
define('IN_PHPBB', true); 
$phpbb_root_path = './'; 
include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 
$forum_id = "1"; 
$jump = make_jumpbox('viewforum.'.$phpEx, $forum_id); 
echo $jump 
?> 
should look like

Code: Select all

<?php 

define('IN_PHPBB', true); 
$phpbb_root_path = './'; 

include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

$forum_id = "1";

echo make_jumpbox('viewforum.'.$phpEx, $forum_id); 

?> 
if you want this to work. (and me being a neatness freak changed the whitespace :P)
[ Working on: It's a secret! ]
[ Links: My Mods | My Site | PALGN ]
DanielT
Former Team Member
Posts: 3324
Joined: Tue Aug 27, 2002 10:55 am
Contact:

Post by DanielT »

hey,

thanks no errors

but no jump box either :s
sj26
Registered User
Posts: 447
Joined: Fri Dec 14, 2001 4:06 pm
Location: /dev/cpu/[0-9]+ :D
Contact:

Post by sj26 »

oops... stupid me... i should have told you that you need to parse the jumpbox template... :oops:

Code: Select all

<?php 

define('IN_PHPBB', true); 
$phpbb_root_path = './'; 

include($phpbb_root_path . 'extension.inc'); 
include($phpbb_root_path . 'common.'.$phpEx); 

// 
// Start session management 
// 
$userdata = session_pagestart($user_ip, PAGE_INDEX); 
init_userprefs($userdata); 
// 
// End session management 
// 

$forum_id = "1"; 

make_jumpbox('viewforum.'.$phpEx, $forum_id); 

echo $template->_tpldata['.'][0]['JUMPBOX'];

?>
I guess this is a quick and dirty fix... it extracts the JUMPBOX variable from the template data. oh well ;)
[ Working on: It's a secret! ]
[ Links: My Mods | My Site | PALGN ]
DanielT
Former Team Member
Posts: 3324
Joined: Tue Aug 27, 2002 10:55 am
Contact:

Post by DanielT »

Thank you!

worked perfect
Post Reply

Return to “[2.0.x] MOD Writers Discussion”