Thread Rating:
  • 8 Vote(s) - 4.25 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add new custom PHP page.
#31
Sad Anyone want to help me?

Edit: Got Xenforo. I gave up on mybb.
[Image: chillaxfullbanner.png]
Reply
#32
(04-04-2012, 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.

Thanks for this tutorial. I tried a whole lot of different tuts for this and none of them worked. This one however, did and I thank you for sharing this.
One question. I got my page up with images, and everything works fine but let's say I wanted to round the corners for my main table, how does one go about that? I tried adding a border radius to several different things but none worked so I'm asking for help on this one.
I've read tuts about adding IMG corners in separate cells but that just seems like too much of a hassle and a lot of jotting things around to get them to work right. I don't want to deal with that. Big Grin
[Image: be811790.gif]
Reply
#33
This user has been denied support. This user has been denied support.
Quote:One question. I got my page up with images, and everything works fine but let's say I wanted to round the corners for my main table, how does one go about that? I tried adding a border radius to several different things but none worked so I'm asking for help on this one.
Main table as in? Can you show in screenshot? Or you mean the table inside trow?
Reply
#34
Yes, the table inside trow.
I have img bgs inside it and it looks bad IMO when my theme is all rounded but this table is not. Thank you.
[Image: be811790.gif]
Reply
#35
Hello, this tutorial worked great, however I am confused on who I could insert PHP code into it. I am a bit new to the MYBB forum script, could someone please explain to me how I would insert PHP into my custom page?
Reply
#36
This user has been denied support. This user has been denied support.
What you wish to add? Everything could be added to it.
Reply
#37
This user has been denied support. This user has been denied support.
Nice tutorial. I have seen similar tutorials here on MyBB Community but they require plugins or are a bit complicated. I found this easy to use.

Edited

By the way, what if I want to add custom permissions, what code do I use?
Reply
#38
You forget to add the template to the $templatelist variable, that will save you one query.
Reply
#39
This user has been denied support. This user has been denied support.
(08-07-2012, 09:44 PM)Omar G. Wrote: You forget to add the template to the $templatelist variable, that will save you one query.
Hmm, where?


(08-07-2012, 09:21 PM)kamz89 Wrote: By the way, what if I want to add custom permissions, what code do I use?
As in disallow certain groups to see the page? Then you can use something like this:

if(in_array($mybb->user['usergroup'], array('2','8')))
{
error("Access denied");
}

You can replace 2 and 8 with any groups you want to disallow seeing that page. You can also add more groups to it to disallow them in a similar fashion.
Reply
#40
(08-08-2012, 05:38 AM)crazy4cs Wrote:
(08-07-2012, 09:44 PM)Omar G. Wrote: You forget to add the template to the $templatelist variable, that will save you one query.
Hmm, where?

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

Should be:
$templatelist = 'template_name';
define('IN_MYBB', 1); require "./global.php";
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)