For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > October 2004 > Re: [SMARTY] number of array elements









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [SMARTY] number of array elements
Boots

2004-10-02, 3:56 am

Try:

{$wo[p]->locations|@count}

Since the php count function can be used as a modifier and you'd use @
to have the modifier treat its input as an array.

--- Steve <lists@iwsys.com> wrote:
> In a template I have the following section:
>
> {section name=p loop=$wo} // $wo is an array of objects
>
> $wo[p]->locations is an array of objects
>
> I would like to know if the number of values in the $wo[p]->locations
> array
> is already available. If so, what is the syntax to display it in a
> template?
>
> Thanks in advance!
>
> Steve

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com