MyBB Community Forums

Full Version: Calling Templates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all. I have been trying to create a new page for my forums. I decided that I would have 1 "parent" template that calls the other templates defined in the php file.

I get the HTTP ERROR 500 when accessing the page and when trying to save the template I get an error saying something about security issues.

Parent Template
Quote:<html>
<head>
<title>1 Mercian - ORBAT</title>
{$headerinclude}
</head>
<body>
{$header}
<div class="orbat-container">
<h2 style="text-align:center;color:#fff;">Order Of Battle</h2>
<br>
<h3 style="text-align:center;color:#fff;">1 Mercian</h3>
<div class="treecontainer">
                <div class="treecentre">
                    <div class="tree">
                        <ul>
                            <li>
                                <div id="title"><img src="https://i.imgur.com/thdhxtB.png" width="60px" height="80px">
                                    <br>Alpha Company, 1MERC</div>
                                <ul id="search_HQ">
                                    <li>
{$1plt_hq}
                                        <ul>
                                            <li>
                                                <div id="title"> <img src="https://i.imgur.com/yXgEZKo.png" width="60px" height="35">
                                                    <br>1 Section</div> <span class="cell" id="search_reme">
{$1plt_1}
<div class="name"><a href="#">Cpl Flint</a></div>
<div class="name"><a href="#">LCpl Minstreal</a></div>
                              <div class="name"><a href="#">Unassigned</a></div>
                              <div class="name"><a href="#">Unassigned</a></div>
<div class="name"><a href="#">Unassigned</a></div>
<div class="name"><a href="#">Unassigned</a></div>
<div class="name"><a href="#">Unassigned</a></div>
<div class="name"><a href="#">Unassigned</a></div>
</span> </li>
                                            <li>
                                                <div id="title"> <img src="https://i.imgur.com/yXgEZKo.png" width="60px" height="35">
                                                    <br>2 Section</div> <span class="cell" id="search_reme">
{$1plt_2}
                                                      <div class="name"><a href="#">Unassigned</a></div>
                                                      <div class="name"><a href="#">Unassigned</a></div>
                                                      <div class="name"><a href="#">Unassigned</a></div>
                                                      <div class="name"><a href="#">Unassigned</a></div>
                                                      <div class="name"><a href="#">Unassigned</a></div>
                                                      <div class="name"><a href="#">Unassigned</a></div>
                                                      <div class="name"><a href="#">Unassigned</a></div>
                                                      <div class="name"><a href="#">Unassigned</a></div>
</li>
<li>
                                        <div id="title"> <img src="https://i.imgur.com/yXgEZKo.png" width="60px" height="35">
                                            <br>3 Section</div>
<span class="cell" id="search_reme">
{$1plt_3}
                                                <div class="name"><a href="#">Unassigned</a></div>
                                                <div class="name"><a href="#">Unassigned</a></div>
                                                <div class="name"><a href="#">Unassigned</a></div>
                                                <div class="name"><a href="#">Unassigned</a></div>
                                                <div class="name"><a href="#">Unassigned</a></div>
                                                <div class="name"><a href="#">Unassigned</a></div>
                                                <div class="name"><a href="#">Unassigned</a></div>
                                                <div class="name"><a href="#">Unassigned</a></div>
                                        </ul>
                                    </li>
                             </ul>
                    </div>
                </div>
            </div>
<h3 style="text-align:center;color:#fff;">ITC Catterick</h3>
<div class="treecontainer">
                <div class="treecentre">
                    <div class="tree">
                        <ul>
                            <li>
                                <div id="title"><img src="https://i.imgur.com/thdhxtB.png" width="60px" height="80px">
                                    <br>Recruit Training Troop</div>
                                <ul id="search_HQ">
                                    <li>
                                        <ul>
                                            <li>
                                                <div id="title"> <img src="https://i.imgur.com/zhqYaWU.png" width="60px" height="35">
                                                    <br>CIC P1</div> <span class="cell" id="search_reme">
         {$itc_cat}
<div class="name"><a href="#">Unassigned</a></div>
<div class="name"><a href="#">Unassigned</a></div>
                              <div class="name"><a href="#">Unassigned</a></div>
                              <div class="name"><a href="#">Unassigned</a></div>
<div class="name"><a href="#">Unassigned</a></div>
<div class="name"><a href="#">Unassigned</a></div>
<div class="name"><a href="#">Unassigned</a></div>
<div class="name"><a href="#">Unassigned</a></div>
</span> </li>
                             </ul>
                    </div>
                </div>
            </div>

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


PHP file:

Quote:<?php 

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

add_breadcrumb("Order of battle", "orbat.php"); 

eval("\$1plt_hq = \"".$templates->get("1plt_hq")."\";");
eval("\$1plt_1 = \"".$templates->get("1plt_1")."\";");
eval("\$1plt_2 = \"".$templates->get("1plt_2")."\";");
eval("\$1plt_3 = \"".$templates->get("1plt_3")."\";");
eval("\$itc_cat = \"".$templates->get("itc_cat")."\";");
eval("\$html = \"".$templates->get("orbat")."\";"); 

output_page($html);

?>


Any help appreciated!
looks like mod_security is triggering due to many links !
check latest entries of server error log (should be available at web host panel)

you may have to contact your web host & ask to disable mod_security OR
add specific rules to resolve the issue ..
How do I go about adding the specific rules to resolve this?
^ generally speaking, web host support people have to analyze it & add the rules ..
There are some variables on the template are not valid variables.
^ oh, yes! Thank You RateU.
@ J. Adams , see PHP Variables - Basics
Quote:A valid variable name starts with a letter or underscore,
followed by any number of letters, numbers, or underscores

i.e. remove starting number in your used variables (eg. $1plt_1 --> $plt_1)