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
(2014-10-16, 10:54 AM)dragonexpert Wrote: [ -> ]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);
?>

Still nothing but white page...

If you wonder how my quiz_naruto template looks, here it is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
  <title>Naruto Quiz</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="trow1 quickreply">
	<center>
<img src="http://www.marineford.com/quiz/quiz.png" alt="" />

<br />
<h1><u>Naruto Quiz</u></h1>

<br />

	<form style="display: inline;" action="/quiz/Nar/quiz.php" method="POST">
		<input align ="center" type="submit" value="Naruto" class="submit">
	</form>
	&nbsp;
	<form style="display: inline;" action="/quiz/Nar/quiz.php" method="POST">
		<input type="hidden" name="mode" value="random">
		<input type="hidden" name="anz" value="6">
		<input align ="center" type="submit" value="6 zufällige Fragen spielen" class="submit">
	</form>
<br />
<br />
</center>
</td>
</tr>
</table>

{$footer}
</body>
</html>

It's a global template.
"First create, somepage.php file."

How do you create a .php file?
(2014-10-26, 03:19 PM)Cierra Wrote: [ -> ]"First create, somepage.php file."

How do you create a .php file?

Go to your filemanager such as Filezilla or another and add the "somepage.php" from there...then do the steps that way.
What if i would like to block certain usergroups from viewing page's content?
oke we have added the page to our forums, but we have a problem with it... why we cant add php code into the template?

we have our own server monitor made and the code cant be pasted inside of it cause it wont working, can anyone support?
Nice tutorial Thanks for share
If not want to group members that get into this, what should I do ?

sorry, my english is very bad
Hi all,

I created php and template as below but my out put is only one bid and shown some error.

Here is my php code;

<?php 

define('IN_MYBB', 1);
define('THIS_SCRIPT', 'books.php');


$templatelist = "media_book";
 require "./global.php";
 
 $query = $db->query("SELECT * from mybb_book order by id DESC");
$bookarray = $db->fetch_array($query);


//$plugins->run_hooks("books_start");

$test    = array();
foreach($bookarray as $books => $key) {

$test = $key['bid'];

}



//$plugins->run_hooks("books_end");

add_breadcrumb("Books", "books.php"); 

eval("\$books = \"".$templates->get("media_books")."\";"); 

output_page($books);

?>

Template is 

<html>
<head>
<title>Books</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<tr>
<td class="thead"><span class="smalltext"><strong>Books... All you can read....</strong></span></td>
</tr>
<tr>

 <table border="0" cellspacing="0" cellpadding="5" class="tborder">
<tbody>
<tr>
<td class="tcat" align="10%"><span class="smalltext"><strong>Upload By</strong></span></a></td>
<td class="tcat" align="40%"><span class="smalltext"><strong>Title</strong></span></a></td>
<td class="tcat" width="10%"><span class="smalltext"><strong>Rating</strong></span></a></td>
<td class="tcat" width="10%"><span class="smalltext"><strong>Viewed</strong></span></a></td>
<td class="tcat" width="5%"><span class="smalltext"><strong>File Type</strong></span></a></td>
<td class="tcat" width="10%"><span class="smalltext"><strong>Added Date</strong></span></a></td>
<td class="tcat" width="10%"><span class="smalltext"><strong>Download</strong></span></a></td>
<td class="tcat" width="15%"><span class="smalltext"><strong>File Size</strong></span></a></td>
</tr>
</tbody>
  

</table>

</tr></table>
{$test}
{$footer}
</body>
</html>

Please someone help me.
Thank you.
Great tutorial thanks!
Pages: 1 2 3 4 5 6 7 8 9 10