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
in my forums page example, using the above method
http://www.kampoeng.us/ Big Grin
This is just what I was looking for. Many thanks.
Hey what if we just created a mybb website and used the cp and orange with it, i downloaded mybb to try and work things out but like i can't upload anything to my website, it's kind of like how a website builder is. Can i get help?? Sad My email is [email protected]
One thing I don't understand i.e in your template part where you wrote
"Add here your custom messages"
Now suppose I want to display list of forums there For that I need some PHP code a loop and some variable now how can I do that?
(2014-07-24, 04:55 PM)burraak Wrote: [ -> ]One thing I don't understand i.e in your template part where you wrote
"Add here your custom messages"
Now suppose I want to display list of forums there For that I need some PHP code a loop and some variable now how can I do that?
If you are looking to have the forums be put into a select box you can use the build_forum_jump function.

/**
 * Builds a forum jump menu
 *
 * @param int The parent forum to start with
 * @param int The selected item ID
 * @param int If we need to add select boxes to this cal or not
 * @param int The current depth of forums we're at
 * @param int Whether or not to show extra items such as User CP, Forum home
 * @param boolean Ignore the showinjump setting and show all forums (for moderation pages)
 * @param array Array of permissions
 * @param string The name of the forum jump
 * @return string Forum jump items
 */
function build_forum_jump($pid="0", $selitem="", $addselect="1", $depth="", $showextras="1", $showall=false, $permissions="", $name="fid")

If you are actually trying to build the list of forums, try using the build_forumbits function. Note that you may have to use require_once "inc/functions_forumlist.php"; in your code before that.

/**
* Build a list of forum bits.
*
* @param int The parent forum to fetch the child forums for (0 assumes all)
* @param int The depth to return forums with.
* @return array Array of information regarding the child forums of this parent forum
*/
function build_forumbits($pid=0, $depth=1)
(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.

Okay I created Few Pages Using Your Code. Thanks for That Smile

Now I Have a Question Because i am Stuck, My Forum Is Only Visible to Registered Members.
Now If a guest click on my example.php page he is redirected to login page.
I want to Allow guests to view my example.php page

how i will do that?
thanks for this costum page script.
(2012-04-04, 02:43 PM)Dragon_Void Wrote: [ -> ]http://community.mybb.com/thread-6615.html

People would rather use a plugin to create custom pages

Way to generalized  statement.  You have no idea what people do or do not want to do.
So people actually want to work more to get similar results?
My point is that you have no answer to that question yourself. You are making a generalization about what "everyone" wants, and you have no way of possible being correct about that.

I would much rather work a little harder if it meant better results in the long run. Keeping in mind that similar and better and not necessarily the same.

I have on many occasions watched people make a lot of decisions I would never make myself. That's life. My job is to realize that it's none of my business what they do.

4 Agreements With Life

1. Never Assume
2. Always Do Your Best
3. Take Nothing Personally
4. Be Impeccable With Your Word

BTW - I do NOT use that plugin. It does not integrate into the SEO as much as my manual pages do, and I like the flexibility of ground up better.

S
Pages: 1 2 3 4 5 6 7 8 9 10