PDA

View Full Version : PHP code ina template


Xencored
02-24-2010, 03:15 PM
Hi all am trying to get my gallery counter to show on my VB's main page and the code is all in PHP

is there any way i could add this to my "fourmhome" template

// returns just the contents of the body
global $database;
global $config;
$base_href = $config->get_string('base_href');
$data_href = get_base_href();
$sitename = $config->get_string('title');
$contact_link = $config->get_string('contact_link');
$counter_dir = $config->get_string('home_counter', 'default');

$total = ceil($database->db->GetOne("SELECT COUNT(*) FROM images"));
$strtotal = "$total";

$num_comma = number_format($total);

$counter_text = "";
for($n=0; $n<strlen($strtotal); $n++)
{
$cur = $strtotal[$n];
$counter_text .= " <img alt='$cur' src='$data_href/ext/home/counters/$counter_dir/$cur.gif' /> ";
}

Thanks

Marco van Herwaarden
02-25-2010, 10:23 AM
You can not usxe PHP in a template. You will need to use a plugin, assign the output of the PHP to a variable and use that in your template.