Categories > TinyButStrong general (FR) >

Re: tableau à plusieur dimension

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: cyrille
Date: 2014-03-26
Time: 11:51

Re: tableau à plusieur dimension

bonjour,
je reviens pour un problème similaire sans réponse cette fois ci hihi

contrairement à plus haut je souhaite exploiter un sous array soit le 1er en [%p1%] et le 2ème [%p2%].
Existe t-il le p2 voici un exemple:
    [0] => Array
        (
            [astr_id] => 5613
            [astr_nom] => F 6sianurt
            [astr_select] =>
            [Slot] => 1
            [liste_slots] => Array
                (
                    [0] => Array
                        (
                            [slot_id] => 308
                            [astr_id_ext] => 5613
                            [usr_id] =>
                            [usr_pseudo] =>
                            [alli_id] =>
                            [alli_nom] =>
                            [fact_id] =>
                            [fact_nom] =>
                            [slot_type_autor] => --
                            [slot_val_autor] => Tous
                            [slot_ress_liste] => Array
                                (
                                    [0] => Array
                                        (
                                            [slot_id_ext] => 308
                                            [ress_id_ext] => 1
                                            [ress_slot_stock] => 0
                                        )

                                    [1] => Array
                                        (
                                            [slot_id_ext] => 308
                                            [ress_id_ext] => 2
                                            [ress_slot_stock] => 0
                                        )

                                    [2] => Array
                                        (
                                            [slot_id_ext] => 308
                                            [ress_id_ext] => 3
                                            [ress_slot_stock] => 0
                                        )

                                )

                        )
je parviens bien à acceder au 1er array avec p1 par contre pas au second ([slot_ress_liste])
voici mon code html
            <div class="SlotListeOpen" astre_id="[BlkSlotListeOpenAstre.astr_id;block=div]">
                <div class="SlotTitre">
                    <span class="SlotType">Type</span>
                    <span class="SlotAutoriser">Autoris&eacute;</span>
                    <span class="SlotRessource">Ressources</span>
                    <span class="SlotAction">Action</span>
                </div>
                <div class="SlotTitre " >
                    <span class="SlotType">[BlkSlotListeOpen.slot_type_autor;block=div;p1=[BlkSlotListeOpenAstre.$]]</span>
                    <span class="SlotAutoriser">[BlkSlotListeOpen.slot_val_autor;p1=[BlkSlotListeOpenAstre.$]]</span>
                    <span class="SlotRessource">
                        <i>                           
                            <img src="image_game/ressource/[BlkSlotRessListeOpen.ress_id_ext].png"
                                alt="[var..cst._RESSOURCE_[BlkSlotRessListeOpen.ress_id_ext]]" title="[var..cst._RESSOURCE_[BlkSlotRessListeOpen.ress_id_ext]]"
                                style="width: 20px; height: 20px;"/>
                            [BlkSlotRessListeOpen.ress_slot_stock;block=i;p1=[BlkSlotListeOpen.$];p2=[BlkSlotListeOpenAstre.$]]
                        </i>
                    </span>
                    <span class="SlotAction"><img id="[BlkSlotListeOpen.slot_id;p1=[BlkSlotListeOpenAstre.$]]" src="image_game/button/action_delete.gif" title="Supprimer le slot" /></span>
                </div>
            </div>

est maintenant le php

        $TBS->mergeBlock('BlkSlotListeOpenAstre', 'array', '_render[Astr_open_slot]');
        $TBS->mergeBlock('BlkSlotListeOpen', 'array', '_render[Astr_open_slot][%p1%][liste_slots]');
        $TBS->mergeBlock('BlkSlotRessListeOpen', 'array', '_render[Astre_user][%p1%][liste_slots][%p2%][slot_ress_liste]');

par avance merci Cyrille
By: cyrille
Date: 2014-03-26
Time: 12:00

Re: tableau à plusieur dimension

Il suffit que je post ici après 3heures sur le même probleme pour trouvé la solution
je n'avais pas mis le même tableau donc oui p2 fonctionne

$TBS->mergeBlock('BlkSlotListeOpen', 'array', '_render[Astr_open_slot][%p1%][liste_slots]');
$TBS->mergeBlock('BlkSlotRessListeOpen', 'array', '_render[Astre_user][%p1%][liste_slots][%p2%][slot_ress_liste]');
By: Skrol29
Date: 2014-03-26
Time: 22:37

Re: tableau à plusieur dimension

J'ai placé ton poste dans un nouveau fil.
ca peut toujours aider.
By: cyrille
Date: 2014-03-31
Time: 10:10

Re: tableau à plusieur dimension

pas de problème tu le sais