|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
gaspo Smarty n00b
Joined: 27 Apr 2010 Posts: 3
|
Posted: Mon Mar 07, 2011 8:37 am Post subject: get index of returned array |
|
|
Hi,
I have multi-dimensional array
Code: | [messages] => Array
(
[0] => Array
(
[id] => 252
[user_id] => 1311666
[message] => fdgdsfg
)
[1] => Array
(
[id] => 223
[user_id] => 1311666
[message] => asdfasff
)
) |
Is there any easy way how to get id of last message?
something like {$messages|@end .id}
{$messages|@end} whis returns array of last message, and I need the ID.
Thank you for any ideas. |
|
Back to top |
|
douglassdavis Smarty Junkie
Joined: 21 Jan 2008 Posts: 541
|
Posted: Mon Mar 07, 2011 12:39 pm Post subject: Re: get index of returned array |
|
|
gaspo wrote: | Hi,
I have multi-dimensional array
Code: | [messages] => Array
(
[0] => Array
(
[id] => 252
[user_id] => 1311666
[message] => fdgdsfg
)
[1] => Array
(
[id] => 223
[user_id] => 1311666
[message] => asdfasff
)
) |
Is there any easy way how to get id of last message?
something like {$messages|@end .id}
{$messages|@end} whis returns array of last message, and I need the ID.
Thank you for any ideas. |
try
Code: |
{$messages|@array_keys|@array_pop}
|
in smarty 3 you don't need the @ |
|
Back to top |
|
Eclypse Smarty n00b
Joined: 19 Aug 2011 Posts: 1
|
Posted: Fri Aug 19, 2011 7:22 am Post subject: |
|
|
Yahoo! I have Smarty 3! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|