MyBB Community Forums
PHP Page | Page Manager | Pull Custom Template - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: 1.8 Support (https://community.mybb.com/forum-175.html)
+--- Forum: General Support (https://community.mybb.com/forum-176.html)
+--- Thread: PHP Page | Page Manager | Pull Custom Template (/thread-208460.html)



PHP Page | Page Manager | Pull Custom Template - isoldehn - 02-20-2017

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


RE: PHP Page | Page Manager | Pull Custom Template - SvePu - 02-20-2017

{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")."\";");



RE: PHP Page | Page Manager | Pull Custom Template - isoldehn - 02-20-2017

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);
?>



RE: PHP Page | Page Manager | Pull Custom Template - SvePu - 02-20-2017

<?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);
?>




RE: PHP Page | Page Manager | Pull Custom Template - isoldehn - 02-20-2017

That worked, thank you very much!!!