(2018-06-10, 02:08 AM)Wires Wrote: [ -> ]Put your code in a template as usual and then use the following code in your .php file:
eval("\$variablehere = \"".$templates->get("your_template_name_here")."\";");
Once you've done that add {$variablehere} to whichever template you want to call it in. It would be easier if you pasted your full code.
I've done this entire process. Adding the code to index.php doesn't make the template callable inside a template. The code you're seeing
is the code that I'm trying to call, but in template form. We list Community Stars each month and I'd like to edit a global template instead of going into the Index template for each theme and doing it manually. However, the quoted method hasn't worked.
This is our Index template. It's kind of a mess. I inherited cleaning this up. Our themes were built for 1.8.7 so when we upgraded to 1.8.15, because our Admin CP was functionally broken it started breaking a lot of things.
<html>
<head>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-43611117-1', 'auto');
ga('send', 'pageview');
</script>
<meta name="description" content="The Omniverse is a play-by-post roleplaying game in an original multiverse setting."/>
<meta name="keywords" content="rpg, roleplay, writing, roleplaying game, crossover, multiverse, play-by-post, PbP, omniverse, game, forum" />
<title>{$mybb->settings['bbname']} • A Crossover Multiverse PbP RPG</title>
{$headerinclude}
<script type="text/javascript">
<!--
lang.no_new_posts = "{$lang->no_new_posts}";
lang.click_mark_read = "{$lang->click_mark_read}";
// -->
</script>
<style type="text/css">
.navigation {display:none;} /*Index only*/
</style>
</head>
<body>
{$header}
<table width="100%" cellspacing="0" cellpadding="{$theme['tablespace']}" border="0">
<tr>
<td valign="top" width="78%">
{$inferno_shoutbox}
{$forums}
{$boardstats}
</td>
<td valign="top">
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead">
<div class="float_left"><strong>Community Stars - Apr '18</strong></div>
</td>
</tr>
<tr>
<td class="trow2">
{$communitystars}
<strong>‘Best’ Character</strong> – <a href="http://omniverse-rpg.com/showthread.php?tid=7358">Serraph Quarrere</a><br>
<strong>‘Best’ Writer</strong> – <a href="http://omniverse-rpg.com/showthread.php?tid=???">Reece</a> <br>
<strong>Most Helpful</strong> – <a href="http://omniverse-rpg.com/member.php?action=profile&uid=150">Kopaka</a><br>
<strong>Rising Star</strong> – <a href="http://omniverse-rpg.com/showthread.php?tid=9763">Taloc</a><br>
<strong>'Best' Story</strong> – <a href="http://omniverse-rpg.com/showthread.php?tid=9881">"The King and His Merry Men" (New Babylon)</a> <br>
<strong>'Best' NPCs</strong> – <a href="http://omniverse-rpg.com/showthread.php?tid=XXXX">Yandere_Lover (Shantotto)</a><br>
<strong>Purple Ribbon</strong> - <a href="http://omniverse-rpg.com/member.php?action=profile&uid=19">Trixie</a><br>
</td>
</tr>
</table>
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead">
<div class="float_left"><strong>Latest Threads</strong></div>
</td>
</tr>
<tr>
<td class="trow2">
<p><div class="latestthreads"></div></p>
<script type="text/javascript">
jQuery(function(){
jQuery(".latestthreads").load("{$mybb->settings['bburl']}/portal.php .latestthreads_portal");
});
</script>
</td>
</tr>
</table>
<br>
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead">
<div class="float_left"><strong>Discord</strong></div>
</td>
</tr>
<tr>
<td class="trow2">
<iframe src="https://discordapp.com/widget?id=152984527176859658&theme=dark" width="200" height="500" allowtransparency="true" frameborder="0"></iframe>
</td>
</tr>
</table>
<br />
</td>
</tr>
</table>
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr><td class="thead"><strong>Affiliates</strong></td></tr>
<tr><td class="trow1">
<a href="http://www.rpgfix.com/" title="RPGfix"><img src="http://i.imgur.com/BshGflJ.gif" alt="RPGfix"/></a>
<a href="http://www.toprpsites.com/"><img src="http://www.toprpsites.com/images/extra/button2.gif" alt="Top RP Sites" /></a><img src="http://www.toprpsites.com/button.php?u=Helixagon&buttontype=text" alt="Top RP Sites" border="0" style="display: none;" width="1px" height="1px"/>
<a href="http://rpg-directory.com/" target="_blank"><img src="https://static18.icyboards.net/rpgdirectory/images/rpgdbutton1.png" alt="RPG-D" title="RPG-Directory" border="0" /></a>
<a href="http://toprpgsites.gotop100.com/in.php?ref=605" target="_blank" rel="nofollow"><img src="http://toprpgsites.gotop100.com/lists/toprpgsites/custombanners/38579.png" border="0" width="88" height="31" alt="Top RPG Sites"> </a>
<a href="http://forumroleplay.gotop100.com/in.php?ref=431"><img src="http://forumroleplay.com/resources/images/site/links/88x31/88x31-vote-dark-gray.png" border="0" title="Forum Roleplay: Roleplay resources catering to play-by-post forum gamers and communities" alt="Forum Roleplay: Roleplay resources catering to play-by-post forum gamers and communities"></a>
<a href='http://landofavalon.com/' target='_blank' rel="nofollow"><img src='http://i283.photobucket.com/albums/kk284/AvalonReborn/Affiliates/Our%20Buttons/RedSmall_Alayel.gif' border='0' /></a>
<a href="http://unbound.b1.jcink.com/" rel="nofollow" target="_blank"><img src="http://i.imgur.com/lIvdp5J.png"></a>
<a href="http://narutobeginnings.forumsmotions.com/forum" rel="nofollow" target="_blank"><img src="http://i450.photobucket.com/albums/qq228/jcharles905/bannerfans_7281930.jpg"></a>
<a href="http://www.narutosaga.com/" rel="nofollow" target="_blank"><img src="http://i80.servimg.com/u/f80/13/07/69/12/button10.png" border="0" alt="Naruto Saga"></a>
<a href="http://magiworld.forumotion.com/" rel="nofollow" target="_blank"><img src="http://i.imgur.com/LdArOEO.png"></a>
</td></tr>
</table><br>
<div align=center><iframe src="http://www.top-site-list.com/vote-button/index.php?siteID=461934&rank=1&layout=s&font=0&textColor=dark&buttonColor=grey&" style="background:none; border:0; border:0; margin:0; padding:0; max-width:100%; width:250px; height:70px; "><a href="http://www.top-site-list.com"><img src="http://www.top-site-list.com/assets/img/tsl80.png" alt="Top Site Lists" /></a></iframe>
<br>
<iframe src="//www.facebook.com/plugins/likebox.php?href=https%3A%2F%2Fwww.facebook.com%2Fomniverserpg&width&height=62&colorscheme=light&show_faces=false&header=true&stream=false&show_border=true" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:62px;" allowTransparency="true"></iframe></div>
<br class="clear" />
{$footer}
</body>
</html>
Thanks for the replies both of you. It's greatly appreciated.