MyBB Community Forums

Full Version: Assign new template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i have created a new template 'index_header' to add some extra meta_tags.

Now i want to assign this code to the <head></head> sections of the site.

How can i assign the 'index_header' template to a difrent template. I have done { $index_header } but this isn't working????
(2009-07-15, 04:06 PM)Gecko Wrote: [ -> ]i have created a new template 'index_header' to add some extra meta_tags.

Now i want to assign this code to the <head></head> sections of the site.

How can i assign the 'index_header' template to a difrent template. I have done { $index_header } but this isn't working????

You need to add:
eval("\$index_header = \"".$templates->get("index_header")."\";");
In every PHP core file (index.php, portal.php) or in a Hook (Using Plugins).
Ok but if i want to leave the core files as they are, this for the future updates of the script!
(2009-07-15, 04:56 PM)Gecko Wrote: [ -> ]Ok but if i want to leave the core files as they are, this for the future updates of the script!

Use a plugin like this:
<?php

$plugins->add_hook("global_end", "my_function_name");

// Plugin Info
function pluginname_info()
{
	return array(
				"name" => "AddCode",
				"description" => "I don't know",
				"website" => "http://mods.mybboard.net",
				"author" => "someone",
				"authorsite" => "http://www.mybboard.net",
				"version" => "0.1",
			);
}



function pluginname_activate()
{
	global $db, $mybb;
	
}

function pluginname_deactivate()
{
	
}

function my_function_name()
{
	global $index_header;
	eval("\$index_header = \"".$templates->get("index_header")."\";"); 
}

?>

I dont know if this works, but I think it should...
Ok this plugin is working thnx for the support.

another question Smile

How can i make a plugin to assign {$footertext} for the footer template?

If i put {$footertext} in the footer template that it wil output the plugin results....