MyBB Community Forums
Why plugin don't show the text? - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Extensions (https://community.mybb.com/forum-201.html)
+--- Forum: Plugins (https://community.mybb.com/forum-73.html)
+---- Forum: Plugin Development (https://community.mybb.com/forum-68.html)
+---- Thread: Why plugin don't show the text? (/thread-211942.html)



Why plugin don't show the text? - Ethernet - 2017-07-25

<?php
if(!defined("IN_MYBB")) die("Zabladziles? ;)");

function character_panel_info() {
	return array(
		"name"			=> "Character Panel v1.0",
		"description"	=> "Character Panel for Redneck Jump RolePlay",
		"website"		=> "",
		"author"		=> "Ethernet",
		"authorsite"	=> "",
		"version"		=> "1.0",
		"guid" 			=> "",
		"compatibility" => "1*"
	);
};

if(defined('THIS_SCRIPT'))
{
    global $templatelist;

    if(isset($templatelist))
    {
        $templatelist .= ',';
    }
	
	$templatelist .= 'characters_index';
}

$plugins->add_hook('global_start', 'character_panel_peis');

function character_panel_peis() 
{
	$message = 'test';
	
	global $lang, $templates;

    $steamID_profile = eval($templates->render('characters_index'));
	
	echo 'done';

};	

?>

Here's my code, I added template characters_index. Why not showing the text from template? I wrote "Hello World" in template, but is don't exist on any page. Any suggestions?


RE: Why plugin don't show the text? - Sazze - 2017-07-26

Use

eval('$page = "' . $templates->get('characters_index') . '";');
output_page($page);



RE: Why plugin don't show the text? - Omar G. - 2017-07-26

I don't think templates get cached before *global_start* so you should probably stick to *global_intermediate*.