PDA

View Full Version : php from templates


owning_y0u
11-23-2011, 08:04 AM
Currently busy with transforming a leaderboard to work inside vbulletin but is it possible to execute PHP directly from the Template files? or do i need to do this on a different way.

Kinda stuck on this now.

for example:

</a></td>
<?php }
echo '<td class="result" style="border-left:'.$style['result_border'].'" height="20px">'.LANG_INDEX_ALL_STATS.'</td>';
if ($row['progress'] == 1){ echo '<td class="result" style="border-left:'.$style['result_border'].'">--</td>'; }
if($row['time'] == 1 ){ echo '<td class="result" style="border-left:'.$style['result_border'].'" height="20px">'.$EoT->timeIndex($gTime).'</td>';}
if($row['kills'] == 1 ){ echo '<td class="result" style="border-left:'.$style['result_border'].'" height="20px">'.$EoT->points($gKills).'</td>'; }
if($row['deaths'] == 1 ){echo '<td class="result" style="border-left:'.$style['result_border'].'" height="20px">'.$EoT->points($gDeaths).'</td>'; }
if($row['round'] == 1 ){ echo '<td class="result" style="border-left:'.$style['result_border'].'" height="20px">'.$EoT->points($gRounds).'</td>';}
if($row['dogtags'] == 1 ){echo '<td class="result" style="border-left:'.$style['result_border'].'" height="20px">'.$EoT->points($gDogtags).'</td>'; }
if($row['kd'] == 1 ){echo '<td class="result" style="border-left:'.$style['result_border'].'" height="20px">'.$EoT->kd($gKills,$gDeaths).'</td>'; }
if($row['team'] == 1 ){echo '<td class="result" style="border-left:'.$style['result_border'].'" height="20px">'.$EoT->points($gTeam).'</td>'; }
if($row['points'] == 1 ){echo '<td class="result" style="border-left:'.$style['result_border'].'" height="20px">'.$EoT->points($gPoints).'</td>'; }
echo '<td class="result" style="border-left:'.$style['result_border'].'" height="20px">--</td>';
?>

is this possible or do i need to add this as a registered variable like lynn has explained in how to make a vbulletin powered page?

kh99
11-23-2011, 12:31 PM
Your're right, you cannot put php in a template, and in vb4 you need to register all variables before using them in a template. The php code can either go in a plugin, or if you're creating a custom page it can just go in your php file.

owning_y0u
11-23-2011, 10:12 PM
Thnx for the answer KH99, i will register all the variables as i think that will make it a more smooth integration in to vbulletin it self