2015-03-25 2 views
2

Je suis nouveau à smarty et je veux imprimer un élément spécifique de tableau dans smarty. J'utilise vtiger open source et vtiger utilise smarty. J'écris ceci pour imprimer un élément spécifique de tableau. Je fais cela dans une boucle foreach:Imprimer élément spécifique de tableau dans smarty

{foreach from=$LISTVIEW_ENTRIES key=j item=LISTVIEW_ENTRY name=listview} 
{$LISTVIEW_ENTRIES[2]} 

{/foreach} 

J'imprime tout tableau avec une fonction de {$LISTVIEW_ENTRIES|@debug_print_var}

Il a donné ceci:

Array (13) 
57 => Accounts_Record_Model Object (1) 
    ->rawData = Array (20) 
    0 => "Nadine Campbell" 
    accountname => "Nadine Campbell" 
    1 => "Accidental Discharge of Water" 
    cf_763 => "Accidental Discharge of Water" 
    2 => "2014-09-07" 
    cf_765 => "2014-09-07" 
    3 => "Refer to Attorney" 
    cf_757 => "Refer to Attorney" 
    4 => "Progressive Insurance" 
    cf_737 => "Progressive Insurance" 
    5 => "2015-02-26 12:52:35" 
    modifiedtime => "2015-02-26 12:52:35" 
    6 => "42 SW 14 Avenue" 
    bill_street => "42 SW 14 Avenue" 
    7 => "Delray Beach" 
    bill_city => "Delray Beach" 
    8 => "Patty Mitrov" 
    cf_809 => "Patty Mitrov" 
    9 => "57" 
    accountid => "57" 

Maintenant, pouvez-vous s'il vous plaît me dire comment imprimer élément spécifique de ce tableau? Je veux imprimer index # 2 de ce tableau

+0

S'IL VOUS PLAÎT UP-VOTE LA RÉPONSE AUSSI. MERCI –

Répondre

0

Essayez ceci: -

Mon format de tableau est comme ceci: -

Array (84) 
    id_product => "112" 
    id_supplier => "6" 
    id_manufacturer => "0" 
    id_category_default => "2" 
    id_shop_default => "1" 
    id_tax_rules_group => "7" 
    on_sale => "0" 
    online_only => "0" 
    ean13 => "" 
    upc => "" 
    ecotax => "0.000000" 
    quantity => 0 

    {foreach from=$products item=product name=products} 
     {$product['id_product']} 
    {/foreach} 

sortie est: - 112