2013-09-17, 08:35 PM
Hello, I am trying to have my plugin integrate a global template into all index page templates. So far, I am able to make the template and modify all the index templates. However, there doesn't seem to be a change on the pages.
Here is my code
This is the template code that I put in
and this is the simple test template
Any help is much appreciated.
Here is my code
<?php
if(!defined("IN_MYBB"))
{
die("You cannot access this file directly. Please Make Sure IN_MYBB Is Defined");
}
function serverStatus_info()
{
return array(
"name" => "",
"description" => "",
"website" => "www.com",
"author" => "test",
"version" => ".1",
"guid" => "",
"compatibility" => "*"
);
}
function serverStatus_activate()
{
global $db, $templates, $plugins;
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
$plugins->add_hook("index_start", "serverStatus_index");
//Get and set the template
$template = '<h5>This is where the server information is going to go. Prepare to have your mind blown</h5>';
//file_get_contents('serverInfo.tmplt');
find_replace_templatesets( "index", '#'.preg_quote('{$announcement}').'#', '{$announcement}{$serverStatusInfo}' );
$db->insert_query('templates', array('title' => 'serverInfo', 'sid' => '-1', 'template' => $db->escape_string($template), 'version' => '1411', 'status' => '', 'dateline' => TIME_NOW));
}
function serverStatus_deactivate()
{
global $db;
require MYBB_ROOT.'/inc/adminfunctions_templates.php';
find_replace_templatesets( "index", '#'.preg_quote('{$announcement}').'#','{$announcement}', 0 );
}
function serverStatus_index()
{
global $templates;
eval("\$serverStatusInfo = \"".$templates->get('serverInfo')."\";");
}
?>
This is the template code that I put in
{$serverStatusInfo}
and this is the simple test template
<h5>Test Template</h5>
Any help is much appreciated.