View previous topic :: View next topic |
Author |
Message |
mzanier_XTC Smarty Regular
Joined: 04 May 2003 Posts: 38
|
Posted: Sat Sep 13, 2003 6:42 pm Post subject: nasty multidimensional arrays |
|
|
hi, its me again )
i searched the forum , but didnt found a post for my solution.
how i can went through multidimensional arrays in my templates ?
i got an array like this:
Code: |
Array
(
[0] => Array
(
[name] => Modell
[data] => Array
(
[0] => Array
(
[id] => 7
[text] => Deluxe Ausgabe
[price] => 39.6
[prefix] => +
)
[1] => Array
(
[id] => 6
[text] => Premium Ausgabe
[price] => 52.8
[prefix] => +
)
[2] => Array
(
[id] => 8
[text] => PS/2 Anschluss
[price] => 26.4
[prefix] => +
)
[3] => Array
(
[id] => 9
[text] => USB Anschluss
[price] => 13.2
[prefix] => +
)
)
)
[1] => Array
(
[name] => Speicher
[data] => Array
(
[0] => Array
(
[id] => 1
[text] => 4 MB
[price] => 79.2
[prefix] => +
)
[1] => Array
(
[id] => 2
[text] => 8 MB
[price] => 66
[prefix] => +
)
)
)
)
|
how i can went through the array using {foreach} ?
tx for any ideas,
mario _________________ [quote]
http://www.xt-commerce.com |
|
Back to top |
|
mzanier_XTC Smarty Regular
Joined: 04 May 2003 Posts: 38
|
Posted: Sat Sep 13, 2003 7:56 pm Post subject: |
|
|
ah, hat nun geklappt )
Code: |
{foreach name=outer item=options_data from=$options}
{$options_data.NAME}
{foreach key=key_data item=item_data from=$options_data.DATA}
{foreach key=sub_key item=sub_options from=$item_data}
{$sub_key}: {$sub_options}
{/foreach}
{/foreach}
|
mfg,
mario _________________ [quote]
http://www.xt-commerce.com |
|
Back to top |
|
mzanier_XTC Smarty Regular
Joined: 04 May 2003 Posts: 38
|
Posted: Sat Sep 13, 2003 8:16 pm Post subject: |
|
|
war doch wohl noch ne ebene zuviel des guten:
Code: |
{foreach name=outer item=options_data from=$options}
<b>{$options_data.NAME}</b> <br>
{foreach key=key_data item=item_data from=$options_data.DATA}
{$item_data.TEXT}
{/foreach}
{/foreach} |
mfg,
mario _________________ [quote]
http://www.xt-commerce.com |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sat Sep 13, 2003 9:05 pm Post subject: |
|
|
hey mzanier_XTC!
My universal translator stopped working somehwere during this thread. Did you solve your problem? |
|
Back to top |
|
mzanier_XTC Smarty Regular
Joined: 04 May 2003 Posts: 38
|
Posted: Sat Sep 13, 2003 9:41 pm Post subject: |
|
|
yep, i solved it
Code: |
<table width="100" border="0" cellspacing="0" cellpadding="0">
{foreach name=outer item=options_data from=$options}
<tr>
<td class="main"><b>{$options_data.NAME}:</b></td>
<td>
<select name="id[{$options_data.ID}]">
{foreach key=key_data item=item_data from=$options_data.DATA}
<option value="1">{$item_data.TEXT} ( {$item_data.PREFIX}{$item_data.PRICE} ) </option>
{/foreach}
</select>
</td>
</tr>
{/foreach}
</table>
|
is working for me
boots, i saw some posts in past regarding variables in .conf files, you got any easy solutions there, without mutliple caching a section ?
cause, my shopsystem got like 5.000 cache files for each language/customer group.
regards,
mario _________________ [quote]
http://www.xt-commerce.com |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Sat Sep 13, 2003 9:54 pm Post subject: |
|
|
I did write a custom config file handler against 2.5.0 that essentially allows templating within the config file, but it was a test only--I didn't bother to get it to a release stage (it was kinda hacky) or upgrade it to the current CVS (which broke my patch in several ways). It was fun to do at the time but in the end, I couldn't really see the need for it.
Do you mean a variable in a config file that gets parsed at runtime but is not cached? Do you have an example of what you are looking for? Perhaps a config file is not the trick in this case--there may be another approach |
|
Back to top |
|
mzanier_XTC Smarty Regular
Joined: 04 May 2003 Posts: 38
|
Posted: Wed Sep 17, 2003 10:07 am Post subject: |
|
|
well it should work like this:
greeting = 'blablabla' $surname $lastname ',blabla' _________________ [quote]
http://www.xt-commerce.com |
|
Back to top |
|
|