xen foreach

DroidHost

Well-known member
I want to use foreach statment but my mind is locked for now
so I want some help here

I have an array
I want the template to enter a loop and fill the variable with diff value
Somethins like
PHP:
array (data=>array( 'names' => array('ali ','james')))
___
in the template if I am correct which I don't

Code:
<xen:foreach loop="$names"    value="$name">

        {$name}

</xen:foreach>
 
Depending on what you have sent to the template would it not be something like the following:

Code:
<xen:foreach loop="$names"    value="$name">
{$name.name}
</xen:foreach>

Would need to see what your actually sending to the template

EDIT: Ignore that, didnt read your post properly LOL
 
Could be way off the mark here .. but would you not be looping through $data.names?
 
PHP:
            <xen:foreach loop="$data"    value="$data">
                <a class="externalLink" rel="nofollow" target="_blank" href="{$data.url}"><img src="{$data.img}" alt="" title="{$data.caption}" /></a>
              </xen:foreach>

I dont know ... maybe if I used it in PHP code level .. will solve this issue
I will think of something !
 
the array :
PHP:
        $data = array(
        'bannars'=>array(
            '1'=>
            array(
             .........
            ),
            '2'=>
            array(
             .........
            ),
            '3'=>
            array(
             .........
            ),
            '4'=>
            array(
            ........
            ),
            '5'=>
            array(
             ...
            ),
        ));

then send $data ...

after that in the template it will work !
HTML:
            <xen:foreach loop="$data"    value="$data">
                <a class="externalLink" rel="nofollow" target="_blank" href="{$data.url}"><img src="{$data.img}" alt="" title="{$data.caption}" /></a>
              </xen:foreach>
 
Top Bottom