Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    May 2007
    Posts
    467
    Tokens
    0

    Default Whats wrong with this?

    Okay its shows no thing it has conent in the template.

    PHP Code:
        $sql_dashboard_tickets $db->select('*''tickets', array('assigned' => $laydesk->user['uid'], 'waiting' => '1'), array('limit' => '0,5'));
        
        while (
    $dashboard_tickets $db->fetch_array($sql_dashboard_tickets)) 
        {
            eval(
    "\$staff_dashboard_tickets = \"".$template->get('staff_dashboard_tickets')."\";");
        } 
    now that does not show nothing but it has stuff in that template but when i do this

    PHP Code:
    $i 1;
    while (
    $i <= 10) {
        
    $yoz $i++;
        eval(
    "\$staff_dashboard_tickets = \"".$template->get('staff_dashboard_tickets')."\";");

    It shows the stuff in the template???

  2. #2
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by VistaBoy View Post
    Okay its shows no thing it has conent in the template.

    PHP Code:
        $sql_dashboard_tickets $db->select('*''tickets', array('assigned' => $laydesk->user['uid'], 'waiting' => '1'), array('limit' => '0,5'));
        
        while (
    $dashboard_tickets $db->fetch_array($sql_dashboard_tickets)) 
        {
            eval(
    "\$staff_dashboard_tickets = \"".$template->get('staff_dashboard_tickets')."\";");
        } 
    now that does not show nothing but it has stuff in that template but when i do this

    PHP Code:
    $i 1;
    while (
    $i <= 10) {
        
    $yoz $i++;
        eval(
    "\$staff_dashboard_tickets = \"".$template->get('staff_dashboard_tickets')."\";");

    It shows the stuff in the template???
    PHP Code:
        $sql_dashboard_tickets $db->select('*''tickets', array('assigned' => $laydesk->user['uid'], 'waiting' => '1'), array('limit' => '0,5'));
        
        while (
    $dashboard_tickets $db->fetch_array($sql_dashboard_tickets)) 
        {
            eval(
    "\$staff_dashboard_tickets = \"".$template->get('staff_dashboard_tickets')."\";");
        } 
    What? You've got a select query to count something. Use this:

    PHP Code:
    $tickets mysql_query'SELECT COUNT(`id`) FROM `tickets` WHERE `assigned` = \'whatever\' AND `waiting` = \'1\' LIMIT 0,5' );
    $tickets mysql_fetch_array$tickets ); 
    then do:


    PHP Code:

    for( $i 0$i $tickets]; $tickets++ )
    {
    // whatever

    Edit:
    also you have this, what is the point in it?

    PHP Code:
    eval("\$staff_dashboard_tickets = \"".$template->get('staff_dashboard_tickets')."\";"); 
    You're just setting the $staff_dashboard_tickets over and over again. It doesn't need an eval.
    Last edited by Jewish Bear; 16-09-2008 at 10:22 AM.


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  3. #3
    Join Date
    May 2007
    Posts
    467
    Tokens
    0

    Default

    Quote Originally Posted by Jewish Bear View Post
    PHP Code:
        $sql_dashboard_tickets $db->select('*''tickets', array('assigned' => $laydesk->user['uid'], 'waiting' => '1'), array('limit' => '0,5'));
        
        while (
    $dashboard_tickets $db->fetch_array($sql_dashboard_tickets)) 
        {
            eval(
    "\$staff_dashboard_tickets = \"".$template->get('staff_dashboard_tickets')."\";");
        } 
    What? You've got a select query to count something. Use this:

    PHP Code:
    $tickets mysql_query'SELECT COUNT(`id`) FROM `tickets` WHERE `assigned` = \'whatever\' AND `waiting` = \'1\' LIMIT 0,5' );
    $tickets mysql_fetch_array$tickets ); 
    then do:


    PHP Code:

    for( $i 0$i $tickets]; $tickets++ )
    {
    // whatever

    Edit:
    also you have this, what is the point in it?

    PHP Code:
    eval("\$staff_dashboard_tickets = \"".$template->get('staff_dashboard_tickets')."\";"); 
    You're just setting the $staff_dashboard_tickets over and over again. It doesn't need an eval.
    What you lost me :S

    "You've got a select query to count something" - hows that a count its getting info from the database :S

    That for loop did not work and i do not think it will fit in to what i want to do??

    also i need the eval as if i do not have it my template system will not work right

    but i fixed it using

    PHP Code:
    $sql_dashboard_tickets $db->select('*''tickets'NULL, array('limit' => '0,5'));
        
        while ( 
    $dashboard_tickets $db->fetch_array$sql_dashboard_tickets ) ) 
        {
            if ( 
    $dashboard_tickets['assigned'] == $laydesk->user['username'] )
            {
                if ( 
    $dashboard_tickets['waiting'] == '1' )
                {
                    eval(
    "\$staff_dashboard_tickets = \"".$template->get('staff_dashboard_tickets')."\";");
                }
            }
            else
            {
                
    $staff_dashboard_tickets 'No tickets for you!';
            }
        } 
    is that right or is there a better why?

  4. #4
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Quote Originally Posted by VistaBoy View Post
    What you lost me :S

    "You've got a select query to count something" - hows that a count its getting info from the database :S

    That for loop did not work and i do not think it will fit in to what i want to do??

    also i need the eval as if i do not have it my template system will not work right

    but i fixed it using

    PHP Code:
    $sql_dashboard_tickets $db->select('*''tickets'NULL, array('limit' => '0,5'));
        
        while ( 
    $dashboard_tickets $db->fetch_array$sql_dashboard_tickets ) ) 
        {
            if ( 
    $dashboard_tickets['assigned'] == $laydesk->user['username'] )
            {
                if ( 
    $dashboard_tickets['waiting'] == '1' )
                {
                    eval(
    "\$staff_dashboard_tickets = \"".$template->get('staff_dashboard_tickets')."\";");
                }
            }
            else
            {
                
    $staff_dashboard_tickets 'No tickets for you!';
            }
        } 
    is that right or is there a better why?
    1) You didn't put any indication that you needed any results picking out
    2) If you need to use eval in your template system, you're doing it wrong.
    3) If it works it's right


    visit my internet web site on the internet
    http://dong.engineer/
    it is just videos by bill wurtz videos you have been warned

  5. #5
    Join Date
    May 2007
    Posts
    467
    Tokens
    0

    Default

    How is using eval in a template system wrong its done by many softwares out there look at some forum softwares they do it. Also how you you do a template system not wrong :S

  6. #6
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    It's right but wrong at the same time, eval wastes time, just set the variable there and then, you don't need eval to come along and say "oh yes lets set that as that" just do it without going through it. It's faster.

  7. #7
    Join Date
    May 2007
    Posts
    467
    Tokens
    0

    Default

    I tryed that is you do not eval the code it just shows this on the page and not the data coming from the database

    {$dashboard_tickets['title']} also does not work if you remove the { and }

  8. #8
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    Post the full code you're using.

  9. #9
    Join Date
    May 2007
    Posts
    467
    Tokens
    0

    Default

    PHP Code:
    if ( $laydesk->user['aid'] >= 
    {
        
    $sql_dashboard_tickets $db->select('*''tickets'NULL, array('limit' => '0,5'));
        
        while ( 
    $dashboard_tickets $db->fetch_array$sql_dashboard_tickets ) ) 
        {
            if ( 
    $dashboard_tickets['assigned'] == $laydesk->user['username'] )
            {
                if ( 
    $dashboard_tickets['waiting'] == '1' )
                {
                   
    $staff_dashboard_tickets $template->get('staff_dashboard_tickets'):
                }
            }
            else
            {
                
    $staff_dashboard_tickets 'non';
            }
        }

    echo  
    $staff_dashboard_tickets
    and template system

    PHP Code:
    function get $title$eslashes )
        {
            
    $filename '../templates/'LayDesk::$setting['template'] .'/'$title .'.tpl';
            
            if ( 
    file_exists($filename) ) 
            {
                
    $template file_get_contents($filename);
            }
            else
            {
                die(
    '<b>LayDesk Error</b> - Template not found: '$filename);
            }
            
            
    $template str_replace "\\'"'\''addslashes $template ) );
            
            return 
    $template;
        } 

  10. #10
    Join Date
    Oct 2006
    Location
    Peterborough, UK
    Posts
    3,855
    Tokens
    216

    Latest Awards:

    Default

    I see no problem w/ that code.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •