Ask a Question related to PHP Development, Design and Development.
-
Mark Lancaster #1
Smarty PHP section looping problem
Hi,
I'm implementing smarty and I am trying to loop through some arrays.
I have this piece of code in a template:
{foreach key=outer_number item=out from=$outer}
<b> {$out.id}</b> <br>
{section name=inner_number loop=$inner[$out.id]}
{$inner[$out.id][inner_number].name} <br>
{/section}
{/foreach}
which once the arrays are filled produces:
7618
7617
7616
7615
As you can see the code is looping through the outer array, displaying
the id but never gets into the inner array using $out.id.
For de-bugging purposes I have hard-coded $out.id with 7618 (one of
the displayed $out.id's) the code now looks like:
{foreach key=outer_number item=out from=$outer}
<b> {$out.id}</b> <br>
{section name=inner_number loop=$inner[7618]}
{$inner[7618][inner_number].name} <br>
{/section}
{/foreach}
which produces:
7618
Goodwin
Montgomerie
Cottey
Adams
Ambrose
Martin-Jenkins
Prior
Davis
Kirtley
Lewry
7617
Goodwin
Montgomerie
Cottey
Adams
Ambrose
Martin-Jenkins
etc
etc
The code is now looping through the outer array and the inner array.
Can anyone suggest how I can get the code to properly use $out.id
inside the inner loop?
Thanks
Mark Lancaster Guest
-
IDCS2: Numbering Section and Inbooklet problem
I've created a booklet and fixed up the Numbering and Section Options so the Auto Numbering begins after the first two pages (by creating a Section)... -
Problem Looping
I am trying to create an array of structures using data collected from a form. The form contains 5 sets of seven fields each set containing... -
problem looping through queries
I am attempting to create a loop that will give me all records in a table whose ids are set to a certain value in a related table. The logic I am... -
looping over a list problem
I am having a problem looping over a list with some elements that are empty. Here is a sample of the list: address_street=8349+White+Dr custom=... -
InDesign Newbie: problem with New Section
Hello, I have been given the job of creating an address directory for a non-profit org. I'm done laying everything out in InDesign, including auto...



Reply With Quote

