PDA

View Full Version : How to fetch data from thread table in threadbit template


omardealo
11-08-2016, 06:22 PM
i make a new filed in thread table on database , and i want fetch data from this filed and show it threadbit template .
i use {vb:raw thread.city} in my code but it is not fetch any data , but it work when i edit forumdisplay.php on line 947 and add city on query , but i want fetch data by plugin only without any edit in files .

hook : parse_templates
code :
global $db ,$vbulletin ,$foruminfo,$threadinfo;

$template = '<ul class="threadstats td"><li align="center">{vb:raw thread.city}</li></ul>';
require_once(DIR . '/includes/class_template_parser.php');
$parser = new vB_TemplateParser('<!-- threadstats -->');
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$find = trim($parser->_parse_nodes($parser->dom_doc->childNodes()));
$parser = new vB_TemplateParser($template);
$parser->dom_doc = new vB_DomDocument($parser->fetch_dom_compatible());
$replace = trim($parser->_parse_nodes($parser->dom_doc->childNodes()));
$vbulletin->templatecache['threadbit'] = str_replace($find, $replace.$find, $vbulletin->templatecache['threadbit']);