Category Box

Post Reply
KMandalia
Posts: 301
Joined: Fri Jul 09, 2004 3:50 pm

Category Box

Post by KMandalia »

I have set up several categories in all walk settings. Now in the <summary> function I am printing the category by referencing it as $Category. It always returns the first category even though I change the category via category box.

What am I doing wrong?
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Category Box

Post by mark »

In the search form the Category box's input variable name is cq, not Category. That's a number that you need to convert to a name for display.
<sql "select Category from categories where Catno=$cq"></sql>
KMandalia
Posts: 301
Joined: Fri Jul 09, 2004 3:50 pm

Category Box

Post by KMandalia »

Well, I do know that. If I change $Category to $cq, it gives me correct category number. I use the sql statement you wrote to get Category corresponding to cq and always get the first category, also the $indexcount doesn't work then.

<b>$start</b> through <b>$end</b> of <b><fmt " %kd " $indexcount></b> records for <b>"$query"</b> on $Category.
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Category Box

Post by mark »

Not sure why you would expect more than one category in that case. I would only expect the matching one. Are you saying you're getting the same category no matter what the value of $cq is?

In general to print all values of a vortex variable you need to loop over it:
<loop $Category>
$Category
</loop>

By doing your sql inside the main sql you've lost indexcount. Do your sql before the main search sql and save the result in another variable for use later in the summary function.
KMandalia
Posts: 301
Joined: Fri Jul 09, 2004 3:50 pm

Category Box

Post by KMandalia »

Thanks for your help. I got it.
Post Reply