MyBB Community Forums

Full Version: Can't include a Template in Portal !
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

I'm currently making a forum for a gaming clan.
I wanted to edit the portal to add custom boxes. I already found plenty of exemples to do it on the forum but not the way I want to.

I don't want to add the code directly in the portal template buf I want to create a global template and just add {$my_template} where i want to put my box instead of put my html code directly in portal template.

But here is my problem :

if I put my code directly in the portal template like this :

<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>
{$header}
<table width="100%" cellspacing="0" cellpadding="5px" border="0" align="center">
<tr>
<td valign="top">
{$announcements}
</td>
<td valign="top" width="325">

<!-- 
          Start Progression PVE
-->

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead_portal"><strong>Kill List PVE</strong></td>
</tr>
<tr>
<td class="trow1" style="border-color:#000000">
<div style="padding:2px 0px;"></div>
<div style="padding:2px 0px;"><img src="images/vGarroshHm.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vParagons.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vBlackfuse.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vThok.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vSpoils.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vMalkorok.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vNazgrim.png" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vChamans.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vMastodonte.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vGalakras.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vShaOrgeuil.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vNorushen.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vProtectors.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vImmerseus.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vRADEN.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vLEISHEN.jpg" alt="" /></div>
</td>
</tr>
</table>

<!--
          Fin Progression PVE
-->
 
{$welcome}
{$pms}
{$search}
{$stats}
{$whosonline}
{$latestthreads}
</td>
</tr>
</table>
{$footer}
</body>
</html>

It will work, like that, BUT if I add many boxes the portal template will be very messy... So i wanted to create a Global template (let's call it "my_template")

and just add in my portal_template :

<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>

{$header}

<table width="100%" cellspacing="0" cellpadding="5px" border="0" align="center">
<tr>
<td valign="top">
{$announcements}
</td>
<td valign="top" width="325">

{$my_template} <!-- Like that ! Cleaner :) -->

{$welcome}
{$pms}
{$search}
{$stats}
{$whosonline}
{$latestthreads}
</td>
</tr>
</table>
{$footer}
</body>
</html>

And so just put this in my global template "my_template"
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead_portal"><strong>Kill List PVE</strong></td>
</tr>
<tr>
<td class="trow1" style="border-color:#000000">
<div style="padding:2px 0px;"></div>
<div style="padding:2px 0px;"><img src="images/vGarroshHm.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vParagons.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vBlackfuse.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vThok.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vSpoils.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vMalkorok.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vNazgrim.png" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vChamans.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vMastodonte.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vGalakras.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vShaOrgeuil.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vNorushen.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vProtectors.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vImmerseus.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vRADEN.jpg" alt="" /></div>
<div style="padding:2px 0px;"><img src="images/vLEISHEN.jpg" alt="" /></div>
</td>
</tr>
</table>

But My template is not integrated ! It seems to be ignored and I don't Know why

If anyone could help me with that, it would be awesome because it'll be easier for me to keep up to date like that.

Thanks in advance guys, Hope you understood what I wanted since English is not my native language.

Cheers !
Yes, template ≠ variable.

Take a look at this: http://community.mybb.com/thread-140152-...pid1008111
It was about a plugin though, but the method is same, if you can get the gist:
http://community.mybb.com/post-1055860.html#pid1055860

Read the comment lines written by me, specially ...
Hey guys, thanks to both of you for your quick answer ! I just went home.

Effone, Your script looks pretty much what I want since it allows to include something stored in global_templates.

Unfortunately i'm kinda unfamiliar with MyBB.

How am i supposed to include my template ?


and thanks in advance for your answer !
effone's solution is a PHP plugin. You need to upload it to inc/plugins, edit for your own needs (other variables, template code, hooks) and activate/install it in ACP. At least little MyBB/PHP knowledge is recommended for this.

My solution does exactly the same thing but you don't need to do anything except inserting <template templatename> to other template.
Yup I saw that and it's almost exactly what I wanted but I need (for pratical purpose) to use Global Template but with your's Destro666 the template has to be located in Ungrouped template.

And you said in the topic you linked :
Quote:If you want the template to be under another templates in ACP, not in ungrouped, you need to write own plugin and insert it to the set you want with query (requires PHP and MySQL knowledge, look how is it done for example in MyAlerts), but I don't see the connection to the question asked in topic.
No, you are misinterpreting my words. I said (s)he can't add templates under Forumdisplay etc. in his/her theme set, only in Ungrouped Templates considering that set (you can't choose under which category the new template should be, it's automatically put below Ungrouped). Global Templates are a different set, which you can choose in dropdown when adding new template in ACP.

Additionally, you have already made a template under Global Templates, haven't you? So I thought it's logical that you can skip that part and just insert the required <template templatename> code because it's already available - templatename is listed under Global Templates. As simple as that.
Indeed ! My bad it's perfect thanks a lot !! Big Grin

+rep ! Thanks to both of you !