Mind blowing SEO improving and Google rank increasing Signature Rotator SEO Tool.

Thread: 

Create a custom PHP page in MYBB without plugin

Ads
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#1
Support Team
I remember once I was looking for a way to add my own custom page without a plugin, ended up using page manager plugin but now that I know how easy it is to actually create a PHP page that will look just like a default MYBB one with header footer and everything I am posting this thread so that you can learn it too. Lets do this.

For the purpose of this tutorial lest say I wanna create a page for 404 not found redirect.

First is first lets create a template that we can edit or customize anytime we wish to.

Log into your Admin Control Panel >> Template & Style >> Templates >> Global Templates >> Add Template

For Template Name type 404
Now paste this code below where the temple code goes:

Code:
<html>
<head>
<title>Your title</title>
{$headerinclude}
</head>
<body>
{$header}
Your Page Content Goes Here!!!!!!!!!!
{$footer}
</body>
</html>

This concludes HTML part.

Now lest do a bit PHP coding don't freak out it's just copy and paste how cool is that Smile

As I have said above for the purpose of this tutorial I am creating 404 not found page but all you have to do is just to change names if you are creating some other page Wink

Create an empty PHP file and add this code into it:

PHP Code:
<?php

define
("IN_MYBB",1);
include(
"global.php");

eval(
"&#092;$page = &#092;"".$templates->get("404")."&#092;";");

    
output_page($page);    

?>

PHP Code:
eval("&#092;$page = &#092;"".$templates->get("404")."&#092;";"); 
In this line here 404 stands for template's name we have just created in global templates.

Save the file as I don't know whatever you want I am gonna call it not-found.php. Remember it has to be located in MYBB root directory, in the same folder with global.php

This is it ladies pretty easy stuff when you know how it works Wink
surenot Offline referral

Posts: 500
Joined: Jan 2014
Reputation: 16

#2
Senior Member
Nice tutorial Marcus keep it going. Goggling for it it appears many are searching for ways to create custom pages without using a plugin.
lion Offline referral

Posts: 122
Joined: May 2014
Reputation: 0

#3
Member
Thanks marcus_avrelius
Nice tutorial
KevinMax Offline referral

Posts: 573
Joined: Aug 2013
Reputation: 78

#4
Senior Member
Nice tuts Marcus. Keep rocking man Smile
maya Offline referral

Posts: 1,058
Joined: May 2013
Reputation: 34

#5
Posting Freak
Creating PHP/HTML page is bit tricky so many will appreciate this article thanks Marcus.
Guest referral

 

#6
Unregistered
How do you create an empty PHP file?

I'm good right up to that instruction. I don't know where/how this is done.
marcus_avrelius Offline referral

Posts: 2,424
Joined: May 2013
Reputation: 102

#7
Support Team
(08-27-2014 08:20 PM)Guest Wrote:  How do you create an empty PHP file?

I'm good right up to that instruction. I don't know where/how this is done.

PHP Code:
<?php
//PHP code goes here
?>

Make sure to save it as .php





User(s) browsing this thread: 1 Guest(s)