MyBB Community Forums

Full Version: PHP Page | Page Manager | Pull Custom Template
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey there,

I'm wanting to pull a custom template into a php page made with page manager. I've tried the following:
<?php
global $headerinclude, $header, $theme, $footer, $db;
add_breadcrumb($pages['name']);
$template='<html><head><title>'.$mybb->settings['bbname']." - ".$pages['name'].'</title>{$headerinclude}</head><body>{$header}




Testing beep? <br /><br />

{$guidebook}



{$footer}</body></html>';
$template=str_replace("\'", "'", addslashes($template));
eval("\$page=\"".$template."\";");
eval("\$guidebook=\"".$templates->get.("guidebook")."\";");
output_page($page);
?>

The page loads but the
{$guidebook}

Does not load. The template is located in my global templates. I'm just not sure how to call it forth and show in the php page of the Page Manager plugin page.

Any help is appreciated! Smile
{header} & {footer} are global variables (not global templates)

Your own variables you have to define first before you can use them.

eval("\$guidebook= \"".$templates->get("guidebook")."\";");
I think I might be misunderstanding you, I added that in before the other eval but now the page won't even load.

Am I supposed to put that elsewhere to call it first?
<?php
global $headerinclude, $header, $theme, $footer, $db;
add_breadcrumb($pages['name']);
$template='<html><head><title>'.$mybb->settings['bbname']." - ".$pages['name'].'</title>{$headerinclude}</head><body>{$header}




Testing beep? <br /><br />

{$guidebook}



{$footer}</body></html>';
$template=str_replace("\'", "'", addslashes($template));
eval("\$guidebook = \"".$templates->get("guidebook")."\";");
eval("\$page=\"".$template."\";");
output_page($page);
?>
<?php
global $headerinclude, $header, $theme, $templates, $footer, $db;

eval("\$guidebook = \"".$templates->get("guidebook")."\";");

$template='<html>
	<head>
		<title>'.$mybb->settings['bbname']." - ".$pages['name'].'</title>
		{$headerinclude}
	</head>
	<body>
		{$header}
		Testing beep? <br /><br />
		{$guidebook}
		{$footer}
	</body>
</html>';
$template=str_replace("\'", "'", addslashes($template));
add_breadcrumb($pages['name']);
eval("\$page=\"".$template."\";");
output_page($page);
?>

That worked, thank you very much!!!