• Login
  • Register
  • Login Register
    Login
    Username:
    Password:
  • Home
  • Members
  • Team
  • Help
  • More
    • YouTube
    • Facebook
User Links
  • Login
  • Register
  • Login Register
    Login
    Username:
    Password:

    Quick Links Home Members Team Help
    More Subscribe YouTube Facebook
    D&D Forums - MyBB Plugins & Themes MyBB General Discussions Tricks & Tutorials Include your custom pages in MyBB

     
    • 0 Vote(s) - 0 Average
    Include your custom pages in MyBB
    AmazOuz
    Offline

    Administrator

    Posts: 272
    Threads: 34
    Joined: Oct 2017
    Reputation: 11
    #1
    09-27-2022, 01:14 AM
    Hello there!


    In case you have made a new page (e.g a rules page) and you'd like to use it along to MyBB! simply you will put a link to that page. but read this and you will have as a part of the board, with headers, navigation, footer etc....

    Let's start.

    1st design the page you want, let's make a simple page

    Code:
    <html>
    <head>
    <title>{$mybb->settings[bbname]}</title>
    {$headerinclude}
    </head>
    <body>
    {$header}
    <br />
    <table width="100%" border="0">
    <thead>
    <tr>
    <th>RULES</th>
    </tr>
    <tbody>
    <tr>
    <td>Our rules</td>
    </tr>
    </tbody>
    </table>
    {$footer}
    </body>
    </html>

    Now go to Admin CP > Templates > Modify / Delete > Expand "Global Templates" > Add template

    Call it rules & put that code

    Now we have hot a template, ready to be used in our new page. note that you customize that the way you want, call it the name you want, as long as you are keeping the unity.

    Now let's make a new php file, let's call it rules.php

    inside it put

    PHP Code:
    <?php

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

    add_breadcrumb("Rules page", "rules.php"); // (2)

    eval("\$rules = \"".$templates->get("rules")."\";"); // (3)
    output_page($rules); // (4)
    ?>

    (1) is very important dont remove it, we need to to connect to the DB, to retrieve templates, to diplay the header and footer etc... , means it's our main part.

    (2) is the navigation name, (e.g MyBB Community Forums / MyBB / General Support / New Thread ), so Rules page refers to what will appear Community Forums / Rules Page and rules.php is your page.

    (3) from here we select which template, so replace rules with you custom name, in both parts.

    (4) is the page that will output the template, same name of the template, however in case you have evaluated it with a different name in stage (3) use the evaluation call name, and not the template name.

    Ok now like that , you can make a link to that page and it will appear as any other page in the board!

    I hope you have enjoyed my tutorial, and that it was helpfull.

    Source : https://community.mybb.com/thread-6615.html

    Greets
    « Next Oldest | Next Newest »

    Users browsing this thread: 1 Guest(s)



    • View a Printable Version
    • Subscribe to this thread
    Forum Jump:

    D&D Company

    Home · Members · Team · Help · Contact

    © D&D - Powered by MyBB

    Paris, France

    07 53 04 58 86

    business@developement.design

    About the company We are a growing company of web developers & designers, specialized in MyBB plugins & themes. Our work is our propaganda.

    Linear Mode
    Threaded Mode