https://www.icyphoenix.com/viewtopic.php?f=35&t=6317 ----------------------------------- AndyGpy Sun 16 Aug, 2009 00:00 Parsing Variables HELP Please ----------------------------------- Hi Guys, I am seriously stryggling and dont know what i have done wrong compared to previous times which seem to work. I have a php file:- [code linenumbers=false] set_filenames(array('body' => 'tickleaderboard.tpl')); if (!$result) { echo "DB Error, could not list tables\n"; echo 'MySQL Error: ' . mysql_error(); exit; } $i = 1; while ($row = mysql_fetch_row($result)) { $nm = $row[0]; $tbl = $nm; $sql2 = "SELECT COUNT(picturetick) AS num FROM `" . $tbl. "` WHERE picturetick "; $result2 = $db->sql_query($sql2); $row2 = $db->sql_fetchrow($result2); $pictnumber = $row2['num']; $sql2 = "SELECT COUNT(lifetick) AS num FROM `" . $tbl. "` WHERE lifetick "; $result2 = $db->sql_query($sql2); $row2 = $db->sql_fetchrow($result2); $lifenumber = $row2['num']; $sql2 = "SELECT COUNT(2009tick) AS num FROM `" . $tbl. "` WHERE 2009tick "; $result2 = $db->sql_query($sql2); $row2 = $db->sql_fetchrow($result2); $yearnumber = $row2['num']; $template->assign_block_vars('leaderboard', array( 'POS' => $i , 'USERNAME' => $nm, 'PICTTOT' => $pictnumber, 'LIFETOT' => $lifenumber, 'YEARTOT' => $yearnumber, ) ); $i++; } // Build the page $template->pparse('body'); // standard page footer include(IP_ROOT_PATH . 'includes/page_tail.'.PHP_EXT); } ?>[/code] which parses to this tpl page [code linenumbers=false]

Below shows the members that have the highest tick count for this year.

 

Member Picture Count Life Count Year Count
{leaderboard.USERNAME} {leaderboard.PICTTOT} {leaderboard.LIFETOT} {leaderboard.YEARTOT}

 

[/code] The problem is, the variables are not past over to the .tpl page. I can echo during the PHP file and the database queries all work ok, i just cannot get the data across to the TPL, any ideas what i am doing wrong. I am using Version 1.3 What i have is a database with tables the same name as the username and i want to create a table of usernames displayed with a summary of field counts in the database. eg username TEST has a Table named TEST with fields A,B,C I want to display TEST 2 6 8 next x x x and so on. regards ----------------------------------- spydie Sun 16 Aug, 2009 00:19 Re: Parsing Variables HELP Please ----------------------------------- have you tried this ??? replace {leaderboard.USERNAME} for {leaderboard_USERNAME} ----------------------------------- AndyGpy Sun 16 Aug, 2009 07:09 Re: Parsing Variables HELP Please ----------------------------------- Its ok Guys, solved it. missed out 2 very inportant lines in the tpl file: blah blah regards ----------------------------------- Lopalong Mon 17 Aug, 2009 09:57 Re: Parsing Variables HELP Please ----------------------------------- Y'Know Andy, I looked at that script three times and didn't see that either. Too many trees and not enough forest. ;) ----------------------------------- DWho Mon 17 Aug, 2009 11:35 Re: [SOLVED] Parsing Variables HELP Please ----------------------------------- Marked as solved