Is it possible to call a forum template from a new .php page?
For example, I want to take the registration page and incorporate it into its own page without the forum header/footer. Just wasn't sure where to start with this.
<?php
define('IN_MYBB', 1); require "./global.php";
$gid = $mybb->user['usergroup'];
$username = $mybb->user['username'];
add_breadcrumb("Page Name", "page.php"); // page.php would be the custom page
eval("\$page= \"".$templates->get("page")."\";"); /$templates->get("page") is the template it is finding in global templates
if($username = $gid == 3 OR $gid == 4) // usergroups allowed to view
{
} else {
error_no_permission(); //shows no permission page if user is not GID 3, or 4
}
output_page($page);
?>
So then you would setup the template.
here's a basic template:
<html>
<head>
<title>Page</title>
{$headerinclude}
</head>
<body>
//{$header} Remove this for no header
template body goes here.
</body>
</html>
</form>
</center>
</td></tr></table>
//{$footer} Remove this for no footer.
</body>
</html>
Sorry been awhile since I have played with MyBB templates and such but I make a new template inside of MyBB with the content I want. Basically if I want to change that page I just change that template. Then I make a .PHP file with the above PHP code which calls that template?
Also, I am assuming I can add JS,jQuery, and AJAX within MyBB templates correct?
Yes to all of the above
You could also get template conditionals which lets you use PHP.
I just tried this and I am not sure whats going on.
Here is what it looks like:
http://i.imgur.com/fJUrmFz.png
Here is my test.php file contents:
<?php
define('IN_MYBB', 1); require "./global.php";
$gid = $mybb->user['usergroup'];
$username = $mybb->user['username'];
add_breadcrumb("Page Name", "test.php"); // page.php would be the custom page
eval("\$page= \"".$templates->get("newreg")."\";"); //$templates->get("newreg") is the template it is finding in global templates
output_page($page);
?>
And the template is everything that the member_register template had in it. I did a straight copy.
If you're using the language strings from the member_register template, you have to add it in the php file.
Before the template is loaded, add:
$lang->load("member");
It helped but the bottom part of the Account Details isn't showing up. It doesn't show the password, referrer, or image verification parts.
Because you need to define variables which are in that template.. Right now they are empty in the file.
Are you talking about the variables like {$passboxes} and {$referrer}, {$regimage}? Unsure what you mean by declaring it. I did some reading and it appears some of these variables can't be called from just anywhere. Not sure how to call it.