|
List Info
Thread: Variable into smarty array
|
|
| Variable into smarty array |

|
2006-03-20 16:02:10 |
instead of {$poste[$offre[1].id_poste]}
which the smarty parser dont like
try assigning the array_key to a variable first
{assign var=array_key value=$offre[1].id_poste}
{$poste[$array_key]}
regards
Pete
Alexandre Cognard wrote:
> Hi everyone,
>
> I often need to use var inside array.
>
> Example:
> $poste =
array("1"=>"poste1",
"2"=>"poste2",
"3"=>"poste3");
> $offre =
array("1"=>array("nom"=>"
;myname","id_poste"=>"1"));
(result from a
> db query)
>
> I assign these array to smarty.
>
> Then into smarty:
> {$poste[1]} => Poste1;
>
> {$offre[1].nom} => myname
> {$offre[1].id_poste} => 1
>
> But {$poste[$offre[1].id_poste]} result to an error.
> I try many syntax, but cant achieve my objective.
>
> Is there's a way ? Or I need to do it into php (I do
it most of time, but
> not very appropriate in whole case).
>
> Regards,
> Alexandre Cognard
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|
|
| Variable into smarty array |

|
2006-03-20 16:05:39 |
Work fine, thanks !
Can we hope a better integration of array in future ?
Smarty is greatful
-----Message d'origine-----
De : Pedro [mailto:daffodil daffodil.uk.com]
Envoyé : lundi 20 mars 2006 17:02
À : smarty-general lists.php.net
Objet : [SMARTY] Re: Variable into smarty array
instead of {$poste[$offre[1].id_poste]}
which the smarty parser dont like
try assigning the array_key to a variable first
{assign var=array_key value=$offre[1].id_poste}
{$poste[$array_key]}
regards
Pete
Alexandre Cognard wrote:
> Hi everyone,
>
> I often need to use var inside array.
>
> Example:
> $poste =
array("1"=>"poste1",
"2"=>"poste2",
"3"=>"poste3");
> $offre =
array("1"=>array("nom"=>"
;myname","id_poste"=>"1"));
(result from
a
> db query)
>
> I assign these array to smarty.
>
> Then into smarty:
> {$poste[1]} => Poste1;
>
> {$offre[1].nom} => myname
> {$offre[1].id_poste} => 1
>
> But {$poste[$offre[1].id_poste]} result to an error.
> I try many syntax, but cant achieve my objective.
>
> Is there's a way ? Or I need to do it into php (I do
it most of time, but
> not very appropriate in whole case).
>
> Regards,
> Alexandre Cognard
--
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
|
|
| Variable into smarty array |

|
2006-03-20 16:20:03 |
--- Alexandre Cognard <alexandre reseaulocal.fr> wrote:
> Work fine, thanks !
>
> Can we hope a better integration of array in future ?
>
> Smarty is greatful
>
> -----Message d'origine-----
> De�: Pedro [mailto:daffodil daffodil.uk.com]
> Envoy�: lundi 20 mars 2006 17:02
> �: smarty-general lists.php.net
> Objet�: [SMARTY] Re: Variable into smarty array
>
> instead of {$poste[$offre[1].id_poste]}
>
> which the smarty parser dont like
>
> try assigning the array_key to a variable first
> {assign var=array_key value=$offre[1].id_poste}
> {$poste[$array_key]}
This should also work:
{$poste[$offre.1.id_poste]}
-- boots
> regards
>
> Pete
>
> Alexandre Cognard wrote:
> > Hi everyone,
> >
> > I often need to use var inside array.
> >
> > Example:
> > $poste =
array("1"=>"poste1",
"2"=>"poste2",
"3"=>"poste3");
> > $offre =
array("1"=>array("nom"=>"
;myname","id_poste"=>"1"));
(result from
> a
> > db query)
> >
> > I assign these array to smarty.
> >
> > Then into smarty:
> > {$poste[1]} => Poste1;
> >
> > {$offre[1].nom} => myname
> > {$offre[1].id_poste} => 1
> >
> > But {$poste[$offre[1].id_poste]} result to an
error.
> > I try many syntax, but cant achieve my objective.
> >
> > Is there's a way ? Or I need to do it into php (I
do it most of time, but
> > not very appropriate in whole case).
> >
> > Regards,
> > Alexandre Cognard
__________________________________________________
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
|
|
| Empty element for html_options |

|
2006-03-21 17:15:54 |
Hi,
I'm on my first project using Smarty and have been
wondering:
html_select_date has the option of having an empty option
selected when
first opening a page.
I would like to have the same when using html_options.
However I do
understand how to use this:
<select name="type_id">
<option value='null'>-- none --</option>
{html_options name=type options=$cust_options
selected=$type_id}
</select>
This will give me two select tags, one inside the other am I
right? Does not
seem easy to work with.
Any suggestions?
Thanks for your help.
Wojciech Duda
--
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 )
|