MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

What exactly ARE the args in [loop arg="A B C"]...?



This is on 3.12 (release 3?) on Solaris (it's a Superb.net hosted site).

I have a MySQL database defined (works fine), with fields along the lines
of:

Code	Category1	Category2	Price		etc. etc. etc.

What I'd like to be able to do is get a listing like:

Category1
	Category2
	Category2
	Category2
Category1 (a different category)
	Category2
	Category2
	Category2

and so on...

Clicking on a Category2 heading would yield a results page with all the
products
belonging to the specific Category1 and Category2 values. (i.e. select code,
description, price, etc. etc. from generic where category1='blah' and
category2='blahblah')

I'm running into conceptual trouble with loop nesting and just WHAT the loop
is meant to iterate over. I tried:

[loop arg='[sql type="param" base="generic"]select distinct category1 from
generic[/sql]']
MARKER: [loop-data generic category1]<BR>
[/loop]

just to try to get any kind of output...I get a page with the correct number
of "MARKER:" lines (as in, the SQL statement returns the correct NUMBER of
values from the DB and the loop tag accepts them as valid ARGS) but the
loop-data tag returns no data. 

Related to the nested loop examples listed in the docs:

[loop arg="A B C"] 
   [loop with="-a" arg="[loop-code]1 [loop-code]2 [loop-code]3"] 
       [loop with="-b" arg="X Y Z"] [loop-code-a]-[loop-code-b]
       [/loop]
   [/loop]
 [/loop]

What is A or B or C? What would the result of these nested loops LOOK like?
Is it:

A1
AX
A2
AX
A3
AX
B1
BX
B2
BX

and so on?

If I could see what the output would look like, I'd get it!!



I also tried nested SQL queries, such as:

[sql type="list" query="select distinct category1 from generic"
base="generic"]
LOOP1: [sql-param category1]<BR>
[sql type="list" query="select distinct category2 from generic where
category1 = '[sql-param category1]'" base="generic"]
LOOP2: [sql-param category2]<BR>
[/sql]
[/sql]

But what I get is:

LOOP1: Category1
LOOP2: Category1 -\
LOOP2: Category1   >  These are the correct NUMBER of category2s 
LOOP2: Category1 -/
LOOP1: Category1 (new category1)
LOOP2: Category1 (new category1) -\
LOOP2: Category1 (new category1) -/  These are the correct NUMBER of
category2s

So it looks like the nested SQL query (LOOP2) is getting the correct number
of values back, but displaying category1 data instead of category2. I am
stumped.

Clearly I have a fundamental misunderstanding of how loops and/or sql
queries function. I realize that a lot of the tags expect to have the
product CODE available but (and this may be a woefully naive statement here)
for the types of displays mentioned above it doesn't appear that I need the
product code (yet).

Whew. I appreciate any and all help. I know the INSTANT I see some nested
loop code and it's associated output I'll "get it." I just need some kind
soul to help me with the initial push...


Many thanks,

Tim

Tim Murphy
Ericsson Research Canada		Packet Switching Systems
8400 Decarie Blvd.
timothy.murphy@lmc.ericsson.se
Town of Mount Royal			tel: (514) 345-7900 ext. 2364
Quebec, Canada				fax: (514) 345-6158
H4P 2N2						



Search for: Match: Format: Sort by: