MyBB Community Forums

Full Version: Add new custom PHP page.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10
unknown location my new page how fix this?
(2014-08-23, 12:03 AM)codetr Wrote: [ -> ]unknown location my new page how fix this?

http://www.communityplugins.com/forum/sh...php?tid=83 (I tend not to link to external sites for tutorials, but that is well written and the most up to date one I see)
So how do I easily create simple page in v 1.8? I do not want to use any plugins in order to create lets say simple advertise.php page where I would have some text about advertising on my forum.
You still can do everything the same in 1.8 for custom pages that you do in 1.6. One major difference is having an option to use $mybb->get_input($fieldname, $type). Note that $type is either 0 for string, 1 for integer, or 2 for array. In 1.8.1 it will get slightly modified, but backwards compatibility will be maintained.
(2012-04-04, 11:57 AM)crazy4cs Wrote: [ -> ]First create, somepage.php file. Inside it, paste below code and save it:


<?php 

define('IN_MYBB', 1); require "./global.php";

add_breadcrumb("Title here", "somename.php"); 

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

output_page($html);

?>
What do I have to use as code, if I want to put this into subfolders, not into the root folder.
E.g. something like www.myforum.com/quiz/sports/get(template_name), how can I make this work?
I tried to use this code and change the eval code, but all I get is white screen. 
Any help? Smile
You have to make the require statement be the path to the global.php file of the forum. It should really be require_once also.
require_once "../global.php";

The ../ makes it go up one folder. Repeat for each folder you need to go up.
(2014-10-16, 09:55 AM)dragonexpert Wrote: [ -> ]You have to make the require statement be the path to the global.php file of the forum. It should really be require_once also.
require_once "../global.php";

The ../ makes it go up one folder. Repeat for each folder you need to go up.

I tried, but it's still white.

I am trying to run a quiz file on my forum, which islocated

root/quiz/Nar/quiz_naruto.php

That's the file I try to start, but it just doesnt work.

My quiz_naruto.php looks like this:

<?php
define("IN_MYBB", 1);
define("NO_ONLINE", 1);
require_once "http://www.marineford.com/global.php";
eval("\$html = \"".$templates->get("quiz_naruto")."\";");
output_page($html);
?>

Where is my mistake? :/
Have you created the template quiz_naruto already?

What is the forum url also?
(2014-10-16, 10:32 AM)dragonexpert Wrote: [ -> ]Have you created the template quiz_naruto already?

What is the forum url also?

Yes I created the template. I did many custom pages in the root folder, it always worked, but now that I try it for the first time in a subfolder, it doesnt.

www.marineford.com is my forum.
Try this:
<?php
define("IN_MYBB", 1);
define("NO_ONLINE", 1);
$templatelist = "quiz_naruto";
error_reporting(E_ALL & ~E_NOTICE);
require_once "../../../global.php";
eval("\$html = \"".$templates->get("quiz_naruto")."\";");
output_page($html);
?>
Pages: 1 2 3 4 5 6 7 8 9 10