problem with dynamic "array key" in smarty

problem with dynamic "array key" in smarty

am 23.10.2006 11:35:44 von rssat

I need to send an array value as a key to another array dynamically in
a template.
pls . Help me.

the sample code is as follows:


{foreach name=outer item=hno key=key from=$hoas}


{$hno.sno} //OK

{$be[{$hno.sno}]} //I tried like this -- but --Wrong

// Here I need to send this {$hno.sno} value as a key to {$be[]}
associative array.



{/foreach}

Re: problem with dynamic "array key" in smarty

am 23.10.2006 11:50:15 von Ulf Kadner

rssat schrieb:

> I need to send an array value as a key to another array dynamically in
> a template.

First: We speak german language here! a english newsgroup also exists.
But your problem isnt a php-problem!

> {foreach name=outer item=hno key=key from=$hoas}
>
>
> {$hno.sno} //OK
>
> {$be[{$hno.sno}]} //I tried like this -- but --Wrong

it looks like smarty or other templateengine. read the manual from youre
templateengine.

You forgot also a important thing. Whats your question?

cu, Ulf

Re: problem with dynamic "array key" in smarty

am 23.10.2006 12:07:50 von rssat

Sorry..
I forgot to mention that i am using smarty template engine...
&
My Question is ...
how to display an assosiative array which has a dynamic key (in a
smarty template)?

regards,
satya.


Ulf Kadner wrote:

> rssat schrieb:
>
> > I need to send an array value as a key to another array dynamically in
> > a template.
>
> First: We speak german language here! a english newsgroup also exists.
> But your problem isnt a php-problem!
>
> > {foreach name=outer item=hno key=key from=$hoas}
> >
> >
> > {$hno.sno} //OK
> >
> > {$be[{$hno.sno}]} //I tried like this -- but --Wrong
>
> it looks like smarty or other templateengine. read the manual from youre
> templateengine.
>
> You forgot also a important thing. Whats your question?
>
> cu, Ulf

Re: problem with dynamic "array key" in smarty

am 23.10.2006 13:14:47 von Tobias Kutzler

rssat schrieb:
> Sorry..
> I forgot to mention that i am using smarty template engine...

And you forgot that Ulf told you that this is a german newsgroup and we
discuss php and not smarty. Please ask in the forum of, if you have any
problems in using smarty: http://www.phpinsider.com/smarty-forum/ or
read the documentation at http://smarty.php.net/ !

Ciao,
Tobias
> &
> My Question is ...
> how to display an assosiative array which has a dynamic key (in a
> smarty template)?
>
> regards,
> satya.
>
>
> Ulf Kadner wrote:
>
>> rssat schrieb:
>>
>>> I need to send an array value as a key to another array dynamically in
>>> a template.
>> First: We speak german language here! a english newsgroup also exists.
>> But your problem isnt a php-problem!
>>
>>> {foreach name=outer item=hno key=key from=$hoas}
>>>
>>>
>>> {$hno.sno} //OK
>>>
>>> {$be[{$hno.sno}]} //I tried like this -- but --Wrong
>> it looks like smarty or other templateengine. read the manual from youre
>> templateengine.
>>
>> You forgot also a important thing. Whats your question?
>>
>> cu, Ulf
>

Re: problem with dynamic "array key" in smarty

am 24.10.2006 15:40:07 von Markus Bemmelen

Ulf Kadner schrieb:
> But your problem isnt a php-problem!

ist so leider nicht ganz richtig: SMARTY basiert auf PHP und mangels NGs
hätte ich diese Frage hier auch gestellt. Aber da scheiden sich
anscheinend die Geister ...

>
>> {foreach name=outer item=hno key=key from=$hoas}
>>
>>
>> {$hno.sno} //OK
>>
>> {$be[{$hno.sno}]} //I tried like this -- but --Wrong

try something like this:
* {$be[$hno.sno]} or
* {assign var=myVar value=$hno.sno}{$be.$myValue}



With kindly regards ... mit freundlichen Grüßen,

Markus