Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
9 - 3 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
   

Re: using smarty to display multidimensional array
by tigums on 2004/6/1 4:23:44

Ah, figured it out

Did a search and found this link
https://xoops.org/modules/newbb/viewtopic.php?topic_id=19614&forum=17#forumpost84369


so my code needed to be
le="color: #000000"><?php <{section name=j loop=$charinfo}> .<{$charinfo[j].first}> <br><br> <{ /section }>



It's pretty much exactly how http://smarty.php.net/manual/en/language.function.section.php (which is the resource I used to make mine section function) defines the section function, yet I, for some reason, didn't figure out what was going on. I still kinda don't, but it works.
[answered] using smarty to display multidimensional array
by tigums on 2004/6/1 4:11:13

I have an array defined, and with smarty debugging on it properly shows in the popup the content of the array.

The structure of the array is

charinfo.[0-#].[first, last, home]

So when I call

$charinfo.0.first

it returns the first name of the first array inside the charinfo array.


Now to display this array, I need to travel through each [0-#] array.

le="color: #000000"><?php <{section name=customer loop=$counter}> .<{$smarty.section.customer.index}> <{/section}>


This does, for example if $counter = 2, display
Quote:

.0
.1


So now I have a way to cycle through the arrays 0-# (or more specifically 0-($counter-1))

but how do I add that index variable into an array call?

things I have tried, and failed with:

le="color: #000000"><?php .<{$charinfo.($smarty.section.customer.index).first}> .<{$charinfo.<{$smarty.section.customer.index}>.first}> .<{$charinfo.{$smarty.section.customer.index}.first}> .<{$charinfo.".$smarty.section.customer.index.".first}> .<{$charinfo."$smarty.section.customer.index".first}> .<{$charinfo.$smarty.section.customer.index.first}> **


** This one, unlike the others, didn't "nuke" the page. The paged looks normal, but still doesn't return any values



the Smarty Debug window displays nothing about the section loop, or any of the calls inside the loop, so I can't find a use for it in this situation.


Note- the leading .'s are placeholders

Who's Online

461 user(s) are online (407 user(s) are browsing Support Forums)


Members: 0


Guests: 461


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits