PDA

View Full Version : Inserting PHP code in common templates


gr8save
04 Jun 2006, 15:12
Hello everyone,

Our bulletin board is conducting elections for moderators. I have written a script to process the elections and it seems to be working well. I'd like to add another feature.

I would like to display at the top of the forum, how many people have voted. To do this I have tried to insert code like this

<tr><td>
<?php
require_once("election-stats.php");
?>
</td></tr>

in the header section of common templates. election-stats.php is a page that connects to my elections database and queries the 'votes' table and uses the following php code
print("there have been " . $voteCount . " votes cast");

I've tested the code on a blank php page so I know it works, but it doesn't display anything when I use it with VB.

Does VB not allow me to insert PHP code like this?

Thanks!
sean