PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.smarty.general > finding array members
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
finding array members

Réponse
 
LinkBack Outils de la discussion
Vieux 06/04/2006, 03h33   #1
D_C
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut finding array members

i am working on a smarty template with some passed in arrays from
another programmer.

is there a way in smarty of walking through the array to find out the
index names etc?

eg in the .tpl

{$array[0].key}

or

{foreach item=fitem key=fkey from=$titem}
{$fkey}

thanks!
--
_______________________________________________
David "DC" Collier
US 1-415-283-7742
dc@pikkle.com
skype: callto://d3ntaku
http://www.pikkle.com
+81 (0)80 6521 9559

http://charajam.com$B!!!Z!z%-%c%i"v%8%c%`!z![(B
$B?M5$%-%c%i$H(BJ-POP$B:G?7%R%C%H6J$r<+J,$GAH$_9g$o$;$F(B
$BBT<u(BFlash$B$dCe(BFlash$B$r:n$C$A$c$*$&!* (B
_______________________________________________
  Réponse avec citation
Vieux 06/04/2006, 14h46   #2
boots
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] finding array members

Well, one simple way is to use php's array_keys as a modifier:

eg:

{assign var=keys value=$record|array_keys}

xo boots

--- D_C <lister@pikkle.com> wrote:

> i am working on a smarty template with some passed in arrays from
> another programmer.
>
> is there a way in smarty of walking through the array to find out the
> index names etc?
>
> eg in the .tpl
>
> {$array[0].key}
>
> or
>
> {foreach item=fitem key=fkey from=$titem}
> {$fkey}
>
> thanks!



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
  Réponse avec citation
Vieux 06/04/2006, 15h43   #3
Wojciech Duda
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut AW: [SMARTY] finding array members

Hello,


Yes there is, kinda like the second example you made:

http://smarty.php.net/manual/en/lang...on.foreach.php


HTH

-----Ursprüngliche Nachricht-----
Von: d3ntaku@gmail.com [mailto:d3ntaku@gmail.com] Im Auftrag von D_C
Gesendet: Thursday, 06 April 2006 4:34
An: Smarty
Betreff: [SMARTY] finding array members

i am working on a smarty template with some passed in arrays from
another programmer.

is there a way in smarty of walking through the array to find out the
index names etc?

eg in the .tpl

{$array[0].key}

or

{foreach item=fitem key=fkey from=$titem}
{$fkey}

thanks!
--
_______________________________________________
David "DC" Collier
US 1-415-283-7742
dc@pikkle.com
skype: callto://d3ntaku
http://www.pikkle.com
+81 (0)80 6521 9559

http://charajam.com ã€â˜…ã‚ャラ♪ジャãƒâ˜…】
人気ã‚ャラã¨J-POP最新ヒット曲を自分ã§çµ„ã¿åˆã‚ã›ã ¦
å¾…å—Flashã‚„ç€Flashを作ã£ã¡ã‚ƒãŠã†ï¼
_______________________________________________

--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
  Réponse avec citation
Vieux 06/04/2006, 17h09   #4
Mark Rogers
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [SMARTY] finding array members

boots wrote:
> Well, one simple way is to use php's array_keys as a modifier:
>
> eg:
>
> {assign var=keys value=$record|array_keys}


Presumably that should be:


{assign var=keys value=$record|@array_keys}

... to have array_keys act on the array as a whole, not on each array element individually.

--
Mark Rogers
More Solutions Ltd :: 0845 45 89 555
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 19h49.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09112 seconds with 12 queries