[ic] query built tabbed display... looking for "do once" tag

Paul Jordan interchange-users@icdevgroup.org
Tue Dec 3 17:54:00 2002


> Quoting Paul Jordan (paul@gishnetwork.com):
> >
> > Hi guys,
> >
> > I built a tabbed-display from a query. I initiate the tabs
> by generating
> > it with a [prefix-change] area, thus creating tabs for my 'vendor'
> > column. This works fine but in this, and other areas, but I
> always run
> > into this little ceveat that always negs me as being a
> inefficient hack.
> >
> > In short, I was wondering if there was a way to have a block of code
> > only show once within an iteration, without using a continual
> > comparison.
> >
>
> You can have multiple [PREFIX-change] things and test for a fixed
> condition.
>
> I do
> 	[sql-change 2][condition]1[/condition]
> 		Some stuff at the top
> 	[/sql-change 2]
>
> quite a bit.
>
> You can also do a [sql-on-match] thing at the top, and at the bottom.
>
> --
> Mike Heins

Thanks for the reply Mike. I am the BIGGEST IDIOT. What I meant was
[!do_once]. I am STUPID!!

I need code that will SKIP the first iteration!! Actually your reply
made me think, and I remembered that prefix-change will take a
[else][/else] pair thus:

[stk-change 2][condition]1[/condition]
	<!-- no output for first -->
 [else]</table>[/tabbed-panel][/else]
[/stk-change 2]

More importantly I realized that these will nest!!! I would guess the
above is more efficient than:

[if explicit]
[condition]
$num = '[stk-increment]';
return 1 if $num eq 1;
return 0;
[/condition]
[else]</table>[/tabbed-panel][/else][/if]

And it sure is cleaner :) I should have tried this first, I guess I had
some sort of mental block becuase the [else][/else] is documented..
sorry for cluttering the archives.

Thanks!

Paul