List Info

Thread: finding array members




finding array members
user name
2006-04-06 02:33:33
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
dcpikkle.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
_______________________________________________

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

finding array members
user name
2006-04-06 13:46:18
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 <listerpikkle.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 

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

AW: finding array members
user name
2006-04-06 14:43:21
Hello,


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

http://smarty.php.net/manual/en/language.function.f
oreach.php


HTH

-----Ursprüngliche Nachricht-----
Von: d3ntakugmail.com [mailto:d3ntakugmail.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
dcpikkle.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

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

finding array members
user name
2006-04-06 16:09:22
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

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )