Add new custom PHP page.
#91
(2012-04-04, 11:57 AM)crazy4cs Wrote: I didn't found some good ones floating around. So here is how I create them and here is how you can create them.

Its quite easy. Heres how you do.

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);

?>

Next, Themes & templates > Templates > Global Templates > Add template.

Add below example template:

<html>
<head>
<title>Your title here</title>
{$headerinclude}
</head>
<body>
{$header}
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<tr>
<td class="thead"><span class="smalltext"><strong>Your title here.</strong></span></td>
</tr>
<tr>
<td class="trow1">

Add here your custom messages.

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

And for title, give any title to it but make sure you enter same title name in the somename.php file where it is calling (evaluating eval) the template name. As in this example case, you should enter title as template_name since we entered and recalled same global template in somename.php file.

Save the global template and it should work fine now.
Let me get this straight..I upload first the php file to forum root folder and then make the template? After that´s done, how can I find my custom page after that?  Undecided
Reply
#92
^ visit => forumURL/filename.php
Reply
#93
(2020-04-26, 02:29 PM).m. Wrote: ^ visit => forumURL/filename.php
Lol..thanks for the reply Big Grin

So something didnt go right with this. While typing the URL to look for the page, it says "file not found".
Maybe I put the php file in the wrong folder?
Reply
#94
^ custom file should be at the main folder of forum
i.e. where you have index.php, global.php files and other files & folders
Reply
#95
Yes, it´s in that folder. I´ve doubled checked the name also that it´s correct.
I don´t have the default theme on my forum. But that shouldn´t matter as long it´s in the global?
Or do I have to set the template in my current theme´s Global Tamplate?

EDIT: Ok, so now it found the file atleast, but still a blank page. 
about-us.php
EDIT2: Finally, now it found the page. Was wrong template name after all Toungue
Sorry and thank you^^
Reply
#96
^ custom file looks for the template in global templates. not related to a specific theme.

is template named correctly as per template name used in the file ?
can you post code of your custom file & content of related template ..

note: I'll be offline in a few minutes
some other helper might check your post & reply
Reply
#97
(2020-04-26, 03:57 PM).m. Wrote: ^ custom file looks for the template in global templates. not related to a specific theme.

is template named correctly as per template name used in the file ?
can you post code of your custom file & content of related template ..

note: I'll be offline in a few minutes
some other helper might check your post & reply
Just edited my previous post. I found the problem. Big Grin
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)