Icy Phoenix

     
 

SOLVED Parsing Variables HELP Please

SOLVED Parsing Variables HELP Please

Article
Reply with quote    Download Post  
Post 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: [Download] [Hide] [Select]
<?php

define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
 
include(IP_ROOT_PATH . 'common.' . PHP_EXT);
include(IP_ROOT_PATH . '/ticklists/ticklistconfig.'.PHP_EXT);

$update = ( isset($_POST['update']) ) ? true : 0;

// standard session management
$userdata = session_pagestart($user_ip);

if ((!$userdata['session_logged_in']) )

   {
        redirect(append_sid(LOGIN_MG . '?redirect=tickindex.' . PHP_EXT));
    
   }

else

   {
        init_userprefs($userdata);
        // set page title
        $page_title = "Scotbird Ticklist Leaderboard -  Members only area !! ";

        // standard page header
        include(IP_ROOT_PATH . 'includes/page_header.'.PHP_EXT);
        
        // Connect to the database
        
        $start = ( isset($_GET['start']) ) ? intval($_GET['start']) : 0;
        $start = ($start < 0) ? 0 : $start;
        
        

        $db = new sql_db($ticklist_mysql_host,$ticklist_mysql_username,$ticklist_mysql_password,$ticklist_mysql_db,false);

            if(!$db)
            {
                die("Database Connection Failed:- Please Contact Site Admin" . mysql_error());
            }

        
            // assign template
        
        
        
        $sql = "SHOW TABLES FROM $ticklist_mysql_db";
        $result = mysql_query($sql);

        $template->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);

   }
  
?>


which parses to this tpl page

Code: [Download] [Hide] [Select]
<style type="text/css">
<!--
.style7 {color: #003300}
.style14 {color: #003300; font-weight: bold; }
.style25 {color: #FF0000; font-weight: bold; font-size: 16px; }
-->
</style>

  <p class="style7"><strong>Below shows the members that have the highest tick count for this year.</strong></p>
  <p class="style7">&nbsp;</p>
  <table width="800" height="143" border="1" cellpadding="0" cellspacing="0" bordercolor="#99CC99">
    <tr>
      <th class="style14" scope="col">Member</th>
      <th class="style14" scope="col">Picture Count</th>
      <th class="style14" scope="col">Life Count</th>
      <th scope="col"><span class="style14">Year Count</span></th>
    </tr>
    <tr>
      <th width="225" class="style14" scope="col"><span class="style7"><span class="style14">{leaderboard.USERNAME}</span></th>
      <th class="style14" width = "91" scope="col"><span class="style7"><span class="style25">{leaderboard.PICTTOT}</span></th>
      <th width = "80" scope="col"><span class="style7"><span class="style25">{leaderboard.LIFETOT}</span></th>
      <th width = "87" scope="col"><span class="style7"><span class="style25">{leaderboard.YEARTOT}</span></th>
    </tr>

<tr></tr>
  </table>

  <p>&nbsp;</p>
  <table class="empty-table" width="100%" cellspacing="0" cellpadding="0" border="0">
  <p>
    <label></label>
  </p>

</table>


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



 
AndyGpy - View user's profile Send private message  
AndyGpy [ Sun 16 Aug, 2009 00:00 ]
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.

Support us


SOLVED Parsing Variables HELP Please

Comments
Reply with quote    Download Post  
Post Re: Parsing Variables HELP Please 
 
have you tried this ???

replace {leaderboard.USERNAME} for {leaderboard_USERNAME}



 
spydie - View user's profile Send private message  
spydie [ Sun 16 Aug, 2009 00:19 ]
Reply with quote    Download Post  
Post Re: Parsing Variables HELP Please 
 
Its ok Guys, solved it.

missed out 2 very inportant lines in the tpl file:

   <!-- BEGIN leaderboard -->

blah
blah

    <!-- END leaderboard -->

regards



 
AndyGpy - View user's profile Send private message  
AndyGpy [ Sun 16 Aug, 2009 07:09 ]
Reply with quote    Download Post  
Post 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.



 
   
Inactive User [ Mon 17 Aug, 2009 09:57 ]
Reply with quote    Download Post  
Post Re: [SOLVED] Parsing Variables HELP Please 
 
Marked as solved



 
DWho - View user's profile Send private message  
DWho [ Mon 17 Aug, 2009 11:35 ]
Display posts from previous:    

HideWas this topic useful?

Post new topic  Reply to topic  Page 1 of 1
 
 




 


 

  cron