https://vborg.vbsupport.ru/showthread.php?t=148112 Sorry for this being posted in another forum.
Will a mod correct this dble posting. Still looking for help here.
Basically as the title states. fetch_template() is returning an empty string. I have two more kpop_ templates which I had working for a few hours and now, there is this. What could cause fetch_template to fail? :erm:
my php file:
PHP Code:
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('THIS_SCRIPT', 'kpop');
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array('kpop_add', 'kpop_remove', 'kpop_error');
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
chdir('/****/******/****/*****/****/');
require_once('./global.php');
if ($vbulletin->userinfo['userid'] == 0 OR !($permissions['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']))
{
print_no_permission();
}
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
if(isset($_GET['tid']) AND is_numeric($_GET['tid']) )
{$tid = $_GET['tid']; }
$t_user = fetch_userinfo($tid);
//add/remove switch
if($_REQUEST['do'] == 'add' )
{
$t_user['newfield5'] = $t_user['field5'] + 1;
eval('print_output("' . fetch_template('kpop_add') . '");');
} elseif($_REQUEST['do'] == 'remove' ) {
$t_user['newfield5'] = $t_user['field5'] - 1;
$vbulletin->userinfo['newfield11'] = $vbulletin->userinfo['field11'] - 2;
eval('print_output("' . fetch_template('kpop_remove') . '");');
}
my template:
PHP Code:
$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>********** *********</title>
<style type="text/css">
.b11 { font-family:Tahoma,Arial,Verdana,Helvetica,sans-serif; font-size:11px; color:#000000; }
.g12 { font-family:Tahoma,Arial,Verdana,Helvetica,sans-serif; font-size:12px; color:#ffc944; }
.g14 { font-family:Tahoma,Arial,Verdana,Helvetica,sans-serif; font-size:14px; color:#ffc944; }
.w11 { font-family:Tahoma,Arial,Verdana,Helvetica,sans-serif; font-size:11px; color:#FFF9E9; }
.w11:link { font-family:Tahoma,Arial,Verdana,Helvetica,sans-serif; font-size:11px; color:#FFF9E9; text-decoration: underline; }
.w11:visited { font-family:Tahoma,Arial,Verdana,Helvetica,sans-serif; font-size:11px; color:#FFF9E9; text-decoration: underline; }
.w11:active { font-family:Tahoma,Arial,Verdana,Helvetica,sans-serif; font-size:11px; color:#FFF9E9; text-decoration: underline; }
.w11:hover { font-family:Tahoma,Arial,Verdana,Helvetica,sans-serif; font-size:11px; color:#FFF9E9; text-decoration: none; }
.my11 { font-family:Tahoma,Arial,Verdana,Helvetica,sans-serif; font-size:11px; color:#FFD774; }
dl.dbox {background:#351405 url(dbox_tl.gif) top left no-repeat; margin:7px 0; padding:0; width:240px;}
dl.dbox dt {background:transparent url(dbox_tr.gif) top right no-repeat; padding:3px; padding-left:10px;}
dl.dbox dd {background:#4e0707 url(dbox_bl.gif) bottom left no-repeat; padding:0; margin:0; color: #fff;}
dl.dbox dd p {background:#4e0707; margin:0; padding:8px; padding-bottom:1px;}
dl.dbox dd p.last {background:transparent url(dbox_br.gif) bottom right no-repeat; }
.charinset {background: transparent; margin:4px 0px; margin-bottom: 0;}
.charinset h1, .charinset p {margin:0 8px;}
.charinset h1 {font-family:Tahoma,Arial,Verdana,Helvetica,sans-serif; font-size:11px; color:#FFF9E9; font-weight: normal;}
.charinset .top, .charinset .bottom {display:block; background:transparent; font-size:1px;}
.charinset .b1, .charinset .b2, .charinset .b3, .charinset .b4, .charinset .b1b, .charinset .b2b, .charinset .b3b, .charinset .b4b {display:block; overflow:hidden;}
.charinset .b1, .charinset .b2, .charinset .b3, .charinset .b1b, .charinset .b2b, .charinset .b3b {height:1px;}
.charinset .b2 {background:#310001; border-left:1px solid #000; border-right:1px solid #1c1711;}
.charinset .b3 {background:#310001; border-left:1px solid #000; border-right:1px solid #33191a;}
.charinset .b4 {background:#310001; border-left:1px solid #000; border-right:1px solid #4e2d2e;}
.charinset .b4b {background:#310001; border-left:1px solid #1c1711; border-right:1px solid #654041;}
.charinset .b3b {background:#310001; border-left:1px solid #33191a; border-right:1px solid #654041;}
.charinset .b2b {background:#310001; border-left:1px solid #4e2d2e; border-right:1px solid #654041;}
.charinset .b1 {margin:0 5px; background:#000;}
.charinset .b2, .charinset .b2b {margin:0 3px; border-width:0 2px;}
.charinset .b3, .charinset .b3b {margin:0 2px;}
.charinset .b4, .charinset .b4b {height:2px; margin:0 1px;}
.charinset .b1b {margin:0 5px; background:#654041;}
.charinset .boxcontent {display:block; background:#310001; border-left:1px solid #000; border-right:1px solid #654041;}
</style>
</head>
<body bgcolor=#000000>
<!-- Start Subtract -->
<dl class="dbox">
<dt><span class=g14><b>Subtract Kharma</b></span></dt>
<dd>
<p>
<table border=0 cellpadding=0 cellspacing=0 width=224 class=w11>
<tr>
<td>You are about to subtract one kharma point from <b>$t_user[username]</b>. To remove one kharma point, your earned kharma points will be reduced by two.</td>
</tr>
<tr>
<td><img src=spacer.gif width=3 height=5></td>
</tr>
<tr>
<td>
<div class="charinset">
<b class="top"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b></b>
<div class="boxcontent">
<table border=0 cellpadding=1 cellspacing=1 align=center width=205 class=w11>
<tr>
<td colspan=2><span class=g12><b>$t_user[username]</b></span></td>
</tr>
<tr>
<td><span class=my11><b>Current Kharma Score:</b></span></td>
<td align=right>$t_user[field5]</td>
</tr>
<tr>
<td><span class=my11><b>New Kharma Score:</b></span></td>
<td align=right>$t_user[newfield5]</td>
</tr>
</table>
</div>
<b class="bottom"><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></b>
</div>
</td>
</tr>
<tr>
<td>
<div class="charinset">
<b class="top"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b></b>
<div class="boxcontent">
<table border=0 cellpadding=1 cellspacing=1 align=center width=205 class=w11>
<tr>
<td colspan=2><span class=g12><b>$bbuserinfo[username] </b></span></td>
</tr>
<tr>
<td><span class=my11><b>Current Kharma Points:</b></span></td>
<td align=right>$bbuserinfo[field11] </td>
</tr>
<tr>
<td><span class=my11><b>New Kharma Points:</b></span></td>
<td align=right>$bbuserinfo[newfield11] </td>
</tr>
</table>
</div>
<b class="bottom"><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></b>
</div>
</td>
</tr>
<tr>
<td><img src=spacer.gif width=3 height=5></td>
</tr>
<tr>
<td>
<div class="charinset">
<b class="top"><b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b></b>
<div class="boxcontent">
<table border=0 cellpadding=1 cellspacing=1 align=center width=205 class=w11>
<tr>
<td><span class=g12><b>Explanation:</b></span></td>
</tr>
<tr>
<td><textarea class=b11 style="width:200px;" rows=3></textarea></td>
</tr>
</table>
</div>
<b class="bottom"><b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b></b>
</div>
</td>
</tr>
<tr>
<td><img src=spacer.gif width=3 height=10></td>
</tr>
<tr>
<td align=center>
<table border=0 cellpadding=1 cellspacing=1 width=200>
<tr><form name="" action="" method="post">
<td align=center><input type=image src=bt_subkarma.gif width=107 height=18 border=0></td>
<td align=center><input type=image src=bt_cancel.gif width=55 height=18 border=0></td>
</tr></form>
</table>
</td>
</tr>
</table>
</p>
<p class="last"></p>
</dd>
</dl>
<!-- End Subtract -->
</body>
</html>
From what Ive seen eval('print_output();' ) works fine by using arbitrary strings.
fetch_template is just not cooperating. 'kpop_add', 'kpop_remove', 'kpop_error' are causing php to crap out or at least return an empty string. As you can see the above template is declared in
PHP Code:
$globaltemplates = array('kpop_add', 'kpop_remove', 'kpop_error');
and called in
PHP Code:
eval('print_output("' . fetch_template('kpop_remove') . '");');
which was also tested like
PHP Code:
eval('$kpop_template = "'.fetch_template('kpop_remove').'";');
eval('print_output($kpop_template);');
What do you guys think? Is there another place I need to declare my template?
Looks like Im just going to bypass template system and put them in the php file. If anyone knows what the problem is though, please respond Ill be checking back as I come here fairly often. This thread could use a bump