greger1911
OMG Member
- Joined
- Nov 29, 2011
- Messages
- 1
I've got this template hook I use to add an extra sidebar element. Can someone guide me through the process of converting this into a template and precaching it in order to reduce database and system load? I understand that spitting the HTML out like I'm doing right now is undesired.
Thank you.
Thank you.
PHP:
<?php
class greg_ShowThing_Plugin_Plugin
{
public static function showThing($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
{
if($hookName == 'forum_list_sidebar')
{
$db = XenForo_Application::get('db');
$query_results = $db->fetchRow("SELECT * FROM `cooltable` WHERE id=1");
$thing = $query_results['thing'];
$thing2 = $query_results['thing2'];
$contents .= '
<div class="section">
<div class="secondaryContent statsList">
<h3>Thing</h3>
<div class="pairsJustified">
<dl><dt>Thing:</dt>
<dd>'.$thing.'</dd></dl>
<dl><dt>Thing 2:</dt>
<dd>'.$thing2.'</dd></dl>
</div>
</div>
</div>
';
}
}
}