MyBB Community Forums

Full Version: [how do you?] insert a custom template on a new page (for page manager)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So, I downloaded LoadTemplates plugin but it doesn't seem to work for this. Basically, I've created a custom template called "guidelinks" to store a navigation menu/miscellaneous coding - which I'll be using on the custom pages created by the Page Manager plugin.

Why? I often redo the pages, add/remove etc and would like to simply edit the list in one place instead of going through ALL the pages just to edit the navigation menu (not to be confused with site navigation, this is a custom menu that'll only appear on my custom pages).

I'd like to put something like {$guidelinks} somewhere in my html and have the content of the guidelinks template appear. BUT I would really really like to enable the "use mybb templates" option so it'll grab my header, footer, etc.

I also don't know anything about php, so please be very specific/clear when answering. I looked through several pages of the Page Manager support thread and couldn't really find anything that related. I even copied/poked at some php snippets that were posted there but nothing seemed to work or display anything other than a plain white page.
You'll want two templates for this. One is for the entire content that should be displayed and the other is a template for your guidelinks. Go for something like this for your PHP Code:
<?php
define("IN_MYBB", 1");
require_once "global.php";
// This next line makes $guidelinks usable in templates.
eval("\$guidelinks = \"".$templates->get("guidelinks")."\";");
// This next line is for the template that has everything on it.
eval("\$pagecontent = \"".$templates->get("template_name")."\";");
output_page($pagecontent);
?>

The template guidelinks can have whatever you want for content. Then the other template you create should have this:

<html>
<head>
<title>Page Title</title>
{$headerinclude}
</head>
<body>
{$header}
{$guidelinks}
{$footer}
</body>
</html>
Thank you for responding.

I've tried the above method with "use mybb template" turned off (so that the php would work) and am still getting a white page. But, this method kind of defeats the ease of using the page manager if I have to make a separate template for the content of each page every time as well as creating the page in page manager... otherwise I could create pages using the method described HERE (which I have done in the past).

I'm the only staff member on my board with FTP access, so it's usually easier to just direct one of them to create a new page instead of waiting for me to log in to create one.

However, if that's the only / simplest way to do what I'm wanting (meaning if I'm going to have to create a template for each page), I'm okay with going back to that system... It's just not as convenient.
Creating new files for me tends to be easier unless you don't need dynamic content. Page Manager is more for designing static pages such as a walkthrough.
That's basically what it's for... It's for our game lore/extras. So far we have 20 pages with the possibility of more being added in the future.

EDIT:
Tried a variety of things that weren't working... so it dawned on me, to edit the page manager plugin itself to include the $guidelinks. Instead of putting the formatting for the page in the page-content, instead I searched the plugin file for where it says "$header" and just added my $guidelinks in after that - right below there's the html/variables that'll appear when mybb templates are enabled, so I just hardcoded my formatting (cause it's the same on every page) with my $guidelinks where I want it to appear next to my page-content.

SOLVED.


Thank you for all the help though. Smile Smile