Categories > TinyButStrong general (FR) >

Problème de sous blocs dynamiques

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Seb
Date: 2009-07-31
Time: 10:03

Problème de sous blocs dynamiques

Salut !

besoin d'aide avec les sous blocs.

Ca marche pas vraiment.

[PHP]
$user=$db->fetchall("
select distinct usr_id
from v_t_assignments
where lng_id='$lang' and (ass_sta_id = 0 or ass_sta_id=1)
order by usr_id
");

$list=$db->fetchall("
select *
from v_t_assignments
where lng_id='$lang' and (ass_sta_id = 0 or ass_sta_id=1)
order by usr_id
");

include_once('tbs/tbs_class_php5.php');
$TBS = new clsTinyButStrong ;
$TBS->NoErr = true;
$TBS->LoadTemplate('revival.html') ;
$TBS->MergeBlock('messages','array','messages');
$TBS->MergeBlock('user','array','user');
$TBS->MergeBlock('list','array','list[%p1%]');
$TBS->Show() ;

[HTML]
      <tr height="*">
        <td>                    
        <div>                        
          <table class="std" cellspacing=0 border=0>                            
            <tbody>
            <tr class="tr1" height="24" onmouseover="this.save=this.className; this.className='selected';" onmouseout="this.className=this.save;">
              <td>
                [user.usr_id;block=tbody]
              </td>
            </tr>
            <tr>
              <td>
                [list.ass_tic_id;block=tr;p1=[user.usr_id]]
              </td>
            </tr>
            </tbody>
            <tbody>
            <tr class="tr2" height="24" onmouseover="this.save=this.className; this.className='selected';" onmouseout="this.className=this.save;">
              <td>
                [user.usr_id;block=tbody]
              </td>
            </tr>
            <tr>
              <td>
                [list.ass_tic_id;block=tr;p1=[user.usr_id]]
              </td>
            </tr>
            </tbody>
          </table>                    
        </div>
        </td>            
      </tr>

Merci de votre aide
By: Skrol29
Date: 2009-07-31
Time: 11:01

Re: Problème de sous blocs dynamiques

ca a l'air correct, qu'est ce qui ne marche pas ? quelle est l'erreur ?

Avec TBS version 3.5.0 (en RC), tu as les sous-blocs automatiques qui peuvent te simplifier la vie.
By: Seb
Date: 2009-07-31
Time: 11:33

Re: Problème de sous blocs dynamiques

En fait j'ai le nom des users qui apparait mais aucune sous ligne...
En fait le truc doit me prendre tous les utilisateurs pour lesquels le statut est à 0 ou 1 et les assignations de ses personnes au statut 0 ou 1 également à afficher en sous block.

je pense que le problème vient de $TBS->MergeBlock('list','array','list[%p1%]');
By: Skrol29
Date: 2009-07-31
Time: 11:50

Re: Problème de sous blocs dynamiques

Commence mettre "$TBS->NoErr = true" en commentaire, pour voir le message d'erreur TBS.
By: Seb
Date: 2009-07-31
Time: 13:24

Re: Problème de sous blocs dynamiques

//$TBS->NoErr = true

Pas d'erreur TBS
By: Skrol29
Date: 2009-07-31
Time: 13:44

Re: Problème de sous blocs dynamiques

Alors il faut vérifier le contenu de tes données avec un
  var_export($user)
et
  var_export($list)
By: Seb
Date: 2009-07-31
Time: 13:55

Re: Problème de sous blocs dynamiques

J'ai des valeurs dans les deux :
var_export($user)
array ( 0 => array ( 'usr_id' => '29', 'usr_name' => 'XXXXX', ), 1 => array ( 'usr_id' => '71', 'usr_name' => 'XXXXX', ), 2 => array ( 'usr_id' => '96', 'usr_name' => 'XXXX', )
var_export($list)
array ( 0 => array ( 'usr_id' => '29', 'ass_tic_id' => '855', ), 1 => array ( 'usr_id' => '29', 'ass_tic_id' => '1105', ), 2 => array ( 'usr_id' => '29', 'ass_tic_id' => '1117', ), 3 => array ( 'usr_id' => '29', 'ass_tic_id' => '1501', ), 4 => array ( 'usr_id' => '29', 'ass_tic_id' => '1755', ), 5 => array ( 'usr_id' => '29', 'ass_tic_id' => '1762', ), 6 => array ( 'usr_id' => '29', 'ass_tic_id' => '1863', ), 7 => array ( 'usr_id' => '29', 'ass_tic_id' => '1944', ), 8 => array ( 'usr_id' => '29', 'ass_tic_id' => '1983', ), 9 => array ( 'usr_id' => '29', 'ass_tic_id' => '1993', ), 10 => array ( 'usr_id' => '29', 'ass_tic_id' => '2024', ), 11 => array ( 'usr_id' => '71', 'ass_tic_id' => '297', ), 12 => array ( 'usr_id' => '71', 'ass_tic_id' => '714', ), 13 => array ( 'usr_id' => '71', 'ass_tic_id' => '723', ), 14 => array ( 'usr_id' => '71', 'ass_tic_id' => '728', ), 15 => array ( 'usr_id' => '71', 'ass_tic_id' => '714', ), 16 => array ( 'usr_id' => '71', 'ass_tic_id' => '959', ), 17 => array ( 'usr_id' => '71', 'ass_tic_id' => '950', ), 18 => array ( 'usr_id' => '71', 'ass_tic_id' => '997', ), 19 => array ( 'usr_id' => '71', 'ass_tic_id' => '1221', ), 20 => array ( 'usr_id' => '71', 'ass_tic_id' => '1566', ), 21 => array ( 'usr_id' => '71', 'ass_tic_id' => '1596', ), 22 => array ( 'usr_id' => '71', 'ass_tic_id' => '1438', ), 23 => array ( 'usr_id' => '71', 'ass_tic_id' => '723', ), 24 => array ( 'usr_id' => '71', 'ass_tic_id' => '297', ), 25 => array ( 'usr_id' => '71', 'ass_tic_id' => '983', ), 26 => array ( 'usr_id' => '71', 'ass_tic_id' => '1746', ), 27 => array ( 'usr_id' => '71', 'ass_tic_id' => '1746', ), 28 => array ( 'usr_id' => '71', 'ass_tic_id' => '1768', ), 29 => array ( 'usr_id' => '71', 'ass_tic_id' => '1896', ), 30 => array ( 'usr_id' => '71', 'ass_tic_id' => '1892', ), 31 => array ( 'usr_id' => '71', 'ass_tic_id' => '1909', ), 32 => array ( 'usr_id' => '71', 'ass_tic_id' => '1994', ), 33 => array ( 'usr_id' => '71', 'ass_tic_id' => '2010', ), 34 => array ( 'usr_id' => '71', 'ass_tic_id' => '2061', ), 35 => array ( 'usr_id' => '96', 'ass_tic_id' => '794', ), 36 => array ( 'usr_id' => '96', 'ass_tic_id' => '879', ), 37 => array ( 'usr_id' => '96', 'ass_tic_id' => '1337', ), 38 => array ( 'usr_id' => '96', 'ass_tic_id' => '1515', ), 39 => array ( 'usr_id' => '96', 'ass_tic_id' => '1501', ), 40 => array ( 'usr_id' => '96', 'ass_tic_id' => '1907', ), 41 => array ( 'usr_id' => '96', 'ass_tic_id' => '1755', ), 42 => array ( 'usr_id' => '96', 'ass_tic_id' => '1938', ), 43 => array ( 'usr_id' => '96', 'ass_tic_id' => '1944', ), 44 => array ( 'usr_id' => '96', 'ass_tic_id' => '1956', ), 45 => array ( 'usr_id' => '96', 'ass_tic_id' => '2024', ), 46 => array ( 'usr_id' => '96', 'ass_tic_id' => '2042', ), 47 => array ( 'usr_id' => '96', 'ass_tic_id' => '2045', ), 48 => array ( 'usr_id' => '121', 'ass_tic_id' => '561', ), 49 => array ( 'usr_id' => '121', 'ass_tic_id' => '978', ), 50 => array ( 'usr_id' => '121', 'ass_tic_id' => '1430', ), 51 => array ( 'usr_id' => '121', 'ass_tic_id' => '1556', ), 52 => array ( 'usr_id' => '121', 'ass_tic_id' => '1891', ), 53 => array ( 'usr_id' => '121', 'ass_tic_id' => '2004', ), 54 => array ( 'usr_id' => '121', 'ass_tic_id' => '2006', ), 55 => array ( 'usr_id' => '504', 'ass_tic_id' => '1940', ), 56 => array ( 'usr_id' => '504', 'ass_tic_id' => '2046', ), 57 => array ( 'usr_id' => '504', 'ass_tic_id' => '2052', ), 58 => array ( 'usr_id' => '504', 'ass_tic_id' => '1881', ), 59 => array ( 'usr_id' => '533', 'ass_tic_id' => '630', ), 60 => array ( 'usr_id' => '533', 'ass_tic_id' => '636', ), 61 => array ( 'usr_id' => '533', 'ass_tic_id' => '920', ), 62 => array ( 'usr_id' => '533', 'ass_tic_id' => '1531', ), 63 => array ( 'usr_id' => '533', 'ass_tic_id' => '1539', ), 64 => array ( 'usr_id' => '533', 'ass_tic_id' => '1562', ), 65 => array ( 'usr_id' => '533', 'ass_tic_id' => '1593', ), 66 => array ( 'usr_id' => '533', 'ass_tic_id' => '1756', ), 67 => array ( 'usr_id' => '533', 'ass_tic_id' => '1920', ), 68 => array ( 'usr_id' => '533', 'ass_tic_id' => '1922', ), 69 => array ( 'usr_id' => '533', 'ass_tic_id' => '1924', ), 70 => array ( 'usr_id' => '533', 'ass_tic_id' => '1926', ), 71 => array ( 'usr_id' => '533', 'ass_tic_id' => '1976', ), 72 => array ( 'usr_id' => '533', 'ass_tic_id' => '2013', ), 73 => array ( 'usr_id' => '533', 'ass_tic_id' => '2018', ), 74 => array ( 'usr_id' => '533', 'ass_tic_id' => '2048', ), 75 => array ( 'usr_id' => '539', 'ass_tic_id' => '959', ), 76 => array ( 'usr_id' => '539', 'ass_tic_id' => '959', ), 77 => array ( 'usr_id' => '553', 'ass_tic_id' => '1106', ), 78 => array ( 'usr_id' => '553', 'ass_tic_id' => '1107', ), )
By: Skrol29
Date: 2009-07-31
Time: 14:46

Re: Problème de sous blocs dynamiques

Moi j'ai le message d'erreur suivant :
TinyButStrong Error in field [list.ass_tic_id...] : item 'ass_tic_id' is not an existing key in the array. This message can be cancelled using parameter 'noerr'.
.

En effet, quand tu écrit 'list[%p1%]', TBS va chercher l'item du tableau en fonction de sa clé uniquement. Par exemple pour usr_id=29, il va chercher l'item $list[29], qui n'existe pas.

Le plus simple dans ton cas c'est de passer par une requête unique et un bloc unique mais avec un entête de groupe (headergrp), ou un groupe parent (parentgrp).
By: Seb
Date: 2009-07-31
Time: 14:59

Re: Problème de sous blocs dynamiques

Merci.... je vais essayer de regarder dans cette direction mais je peux peux être faire une requête qui va chercher ass_tic_id et le stocker dans $user pour ensuite faire le lien avec $ilst