-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathictags.sdf
17363 lines (12075 loc) · 455 KB
/
ictags.sdf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
!init OPT_LOOK="icdevgroup"; OPT_STYLE="manual"
# $Id: ictags.sdf,v 1.123 2005-07-20 02:22:20 jon Exp $
!define DOC_NAME "Interchange Tags Reference"
!define DOC_TYPE ""
!define DOC_CODE "ictags"
!define DOC_VERSION substr('$Revision: 1.123 $', 11, -2)
!define DOC_STATUS "Draft"
!define DOC_PROJECT "Interchange"
!define DOC_URL "http://www.icdevgroup.org/doc/ictags.html"
!define DOC_OWNER "2002-2004 Interchange Development Group, 1996-2002 Red Hat, Inc."
!define SHOW_COMMENTS 0
!define EXAMPLE_SESSION "6CZ2whqo"
!define EXAMPLE_DOMAIN "www.here.com"
!define EXAMPLE_CATALOG "mycatalog"
!define EXAMPLE_VLINK "mycatalog"
!define EXAMPLE_SECURE_DOMAIN "secure.here.com"
!define EXAMPLE_SKU "os28044"
!define EXAMPLE_PRICE 19.99
!define EXAMPLE_SIZE "15oz"
!define EXAMPLE_SIZE1 "10oz"
!define EXAMPLE_SIZE2 "20oz"
!define EXAMPLE_DESCRIPTION "Framing Hammer"
!build_title
H1:Interchange Tag Reference
Interchange functions are accessed via the Interchange Tag Language (ITL).
The pages in a catalog may be mostly HTML, but they will use ITL tags
to provide access to Interchange's functions. ITL is a superset of
MML, or Minivend Markup Language. Minivend was the predecessor to
Interchange.
These tags perform various display and modification operations for
the user session. There nearly 100 standard predefined tags, and the
C<UserTag> facility allows you to create tags that perform your own
functions and can be just as powerful as the built-in tags.
This document covers Interchange versions 4.7 through 4.9.
H1:Tag Syntax
ITL tags are similar to HTML in syntax, in that they accept
parameters or attributes and that there are both I<standalone> and
I<container> tags.
We will call an attribute a I<parameter> if it may be called
positionally or if it must be included (see the
{{CMD[jump="#parameters"]parameter}} and
{{CMD[jump="#attributes"]attribute}} sections below).
A standalone tag has no ending element, e.g.:
E: E<lbracket>{{C[jump="#value"]value name}}]
This tag will insert the user's name, providing they have given it
to you in a form. A container tag has both a beginning and an ending
element, as in:
!block example
E<lbracket>{{C[jump="#if"]if}} value name]
You have a name. It is [C<value> name].
E<lbracket>/if]
!endblock
H2:Standard Syntax
The most common syntax is to enclose the tag with its parameters and
attributes in C<[square brackets]>. If the tag has an end tag, the tag and
its end tag will delimit contained body text:
!block example
E<lbracket>B<tagname> I<parameters> I<attributes>]Contained Body Text[/tagname]
!endblock
!block note; label="CaveatE<nbspace>E<emdash> macros: "
Some macros look like tags or end tags. For example,
E<lbracket>{{C[jump="#page"]/page}}E<rbracket> is a macro for
E<lt>/AE<gt>. This allows you to conveniently write
E<lbracket>{{C[jump="#page"]page}}E<nbspace>I<href>]Target[C</page>],
but 'Target' is not treated as contained body text.
!endblock
When using the [C<tagname> ...] syntax, there must be no whitespace
between the left bracket ('[') and the tagname.
If a tag name includes an underscore or dash, as in
E<lbracket>{{CMD[jump="#item-list"]item_list}}], a dash is just as appropriate
(i.e. C<[item-list]>). The two forms are interchangeable, except that an
ending tag must match the tag (i.e., don't use
C<E<lbracket>item-list]E<nbspace>listE<nbspace>[/item_list]>).
H2: HTML-Comment
ITL also allows you to use 'E<lt>!--[' and ']--E<gt>' as
interchangeable alternatives to plain square brackets:
C<E<lbracket>tagname]> and C<E<lt>!--[tagname]--E<gt>> are
equivalent.
This allows you make your raw tags appear as comments to HTML browsers
or editors. You might want to do this if your editor has trouble with
ITL tags when editing Interchange page templates, or alternatively, if
you want to use one .html file both as an Interchange template and as
a static page delivered directly by your web server, without
Interchange processing.
To properly HTML-comment contained body text, place your comment-style
brackets appropriately, for example:
E: E<lt>!--[tagname] Contained Body Text E<lbracket>/tagname]-->
Note that you must include whitespace between the HTML comment
delimiters and the square brackets if you wish to actually comment out
tag output in the browser. For example, if
E<lbracket>{{C[jump="#value"]value}}E<nbspace>name] expands to 'Bill':
E: 'E<lt>!--[value name]-->' becomes 'Bill'
E: 'E<lt>!-- [value name] -->' becomes '<!-- Bill -->'
H3: Technical notes
While '<!--[' and '[' are completely interchangeable, the Interchange
parser does not replace ']-->' with ']' unless it also sees '<!--['
at least once somewhere on the page. (This is a small parsing speed optimization.)
See the {{CMD[jump="#Template Parsing Order"]Template Parsing Order}}
appendix if you are modifying the special administrative interface
pages and intend to use this syntax.
H2: {{CMD[id="parameters"]Named vs. Positional Parameters}}
There are two styles of supplying parameters to a tag: named and positional.
In the named style you supply a parameter name=value pair just as most HTML
tags use:
E: E<lbracket>{{CMD[jump="#value"]value}} name="foo"]
The positional-style tag that accomplishes the same thing looks like this:
E: E<lbracket>value foo]
The parameter C<name> is the first positional parameter for the
C<E<lbracket>{{CMD[jump="#value"]value}}]> tag. Some people find
positional usage simpler for common tags, and Interchange interprets
them somewhat faster. If you wish to avoid ambiguity you can always
use named calling.
In most cases, tag parameters specified in the positional fashion work
the same as named parameters. However, there are a few situations where
you need to use named parameters:
^If you want to specify a parameter that comes positionally after a
parameter that you want to omit, e.g. omit the first parameter but specify
the second. The parser would have no way of knowing which is which, so
you just specify the second by name. This is rare, though, because the
first positional parameters are usually required for a given tag anyway.
+When there is some ambiguity as to which parameter is which, usually
due to whitespace.
+When you need to use the output of a tag as the parameter or attribute
for another tag.
H3: Interpolating parameters
If you wish to use the value of a tag within a parameter of another
tag, you cannot use a positional call. You must also double-quote the
argument containing the tag you wish to have expanded. For example,
this will not work:
E: E<lbracket>{{C[jump="#page"]page}} scan se=[{{C[jump="#scratch"]scratch}} somevarE<2]>
To get the output of the C<[scratch somevar]> interpreted, you must
place it within a named and quoted attribute:
E: E<lbracket>{{C[jump="#page"]page}} href=scan arg="se=[{{C[jump="#scratch"]scratch}} somevar]"]
Note that the argument to B<href> ('scan') did not need to be quoted;
only the argument to B<arg>, which contained a tag, needed the quotes.
H2: {{CMD[id="attributes"]Universal Attributes}}
Universal attributes apply to all tags, though each tag specifies
its own default for the attribute. The code implementing universal
attributes is external to the core routines that implement specific
tags.
H3: {{CMD[id="attr_interpolate"]interpolate}}
This attribute behaves differently depending upon whether the tag is a
I<container> or I<standalone> tag. A container tag is one which has
an end tag, i.e. C<[tag] stuff [/tag]>. A standalone tag has no end
tag, as in
E<lbracket>{{CMD[jump="#area"]area}}E<nbspace>href=somepage]. (Note
that E<lbracket>{{CMD[jump="#page"]page}} ...] and
E<lbracket>{{CMD[jump="#order"]order}} ..] are B<not> container tags.)
I<For container tags (interpolated)>
* If true ("interpolate=1"), the Interchange server will first process
any tags within the body text before passing it to the enclosing tag.
* If false ("interpolate=0"), the enclosing tag will receive the raw
body text.
I<For standalone tags (reparsed)>
* If true, the server will process the I<output> of the tag. This is
identical to the behavior of the {{CMD[jump="#attr_reparse"]reparse}} attribute (see below for
explanation and examples).
(Note: The mixing of 'interpolate' and 'reparse' logic occurred
because 'interpolate' already worked this way when 'reparse' was added
to Interchange. This may be fixed in a later release...)
Most standalone tags are not reparsed by default (i.e., interpolate=0
by default). There are some exceptions, such as the
E<lbracket>{{CMD[jump="#include"]include}}] tag.
N: Interpolation example:
Assuming that C<name> is 'Kilroy',
!block example
E<lbracket>{{C[jump="#log"]log}} interpolate=1][{{C[jump="#value"]value}}C< name>] was here[/log]
E<lbracket>{{C[jump="#log"]log}} interpolate=0][{{C[jump="#value"]value}}C< name>] was here[/log]
!endblock
the first line logs 'Kilroy was here' to I<catalog_root>/etc/log,
while the second logs '[valueE<nbspace>name] was here'.
N: Reparsing example:
Suppose we set a scratch variable called 'now' as follows:
!block example
E<lbracket>{{C[jump="#set"]set}} name=now interpolate=0][{{C[jump="#time"]time}}]%A, %B %d, %Y[/time][/set]
!endblock
If today is Monday, January 1, 2001,
!block example
E<lbracket>{{C[jump="#scratch"]scratch}} name=now interpolate=0]
E<lbracket>{{C[jump="#scratch"]scratch}} name=now interpolate=1]
!endblock
the first line yields
E: E<lbracket>{{C[jump="#time"]time}}]%A, %B %d, %Y[/time]
while the second yields
E: Monday, January 1, 2001
H3: {{CMD[id="attr_reparse"]reparse}}
If true ("reparse=1"), the server will process any tags in the text
output by the reparsed tag.
Reparse applies only to container tags (those with an end tag). The
C<interpolate> attribute controls reparsing of the output of
standalone tags (see above).
Most container tags will have their output re-parsed for more
Interchange tags by default. If you wish to inhibit this behavior, you
must explicitly set the attribute B<reparse> to 0. Note that you will
almost always want the default action. The only container ITL tag that
doesn't have reparse set by default is
C<E<lbracket>{{CMD[jump="#mvasp"]mvasp}}]>.
N: Example:
Assuming that C<name> is 'Kilroy',
!block example
1. E<lbracket>{{C[jump="#perl"]perl}} reparse=0]
my $tagname = 'value';
return "[$tagname name] was here\n"
[/perl]
2. E<lbracket>{{C[jump="#perl"]perl}} reparse=1]
my $tagname = 'value';
return "[$tagname name] was here\n"
[/perl]
!endblock
expands to
!block example
1. E<lbracket>{{C[jump="#value"]value}}C< name>] was here
2. Kilroy was here
!endblock
H3: {{CMD[id="attr_send"]send}}
Deprecated
H2: Tag-specific Attributes
Each tag may accept additional named attributes which vary from tag to
tag. Please see the entry for the tag in question for details about
tag-specific attributes.
H2: {{CMD[id="attr_array_hash"]Attribute Arrays and Hashes}}
Some tags allow you to pass an array or hash as the value of an
attribute. For an ordinary tag, the syntax is as follows:
!block example
attribute.I<n>=value
attribute.hashkey=value
!endblock
where I<n> is an integer array index. Note that you cannot use both an
array and a hash with the same attributeE<nbspace>E<emdash> if you use
B<attribute.I<n>>, you cannot also use B<attribute.key> for the same
attribute.
Here is an example of an attribute array:
!block example
search.0="se=hammer
fi=products
sf=description"
search.1="se=plutonium
fi=products
sf=comment"
!endblock
The E<lbracket>{{C[jump="#page"]page}}] tag, for example, treats a search
specification array as a joined search, automatically adding the other
relevant search fields, including the 'co=yes' to indicate a combined
search ({{CMD[jump="icdatabase.html#Coordinated and Joined Searching"]joined searches}}
are described in the Interchange database documentation).
Note that it is up to the tag to handle an array or hash value
properly. See the documentation for the specific tag before passing
it an attribute array or hash value.
H3: Perl calls
Before passing attributes to a tag, the Interchange parser would
convert the above example to an anonymous array reference. It would
use the resulting arrayref as the value for the 'search' attribute in
this example.
If you were passing the above example directly to a tag routine
within a E<lbracket>{{C[jump="#perl"]perl}}] block or a
{{C[jump="#User-defined Tags"]usertag}}, you must actually pass an
anonymous array as the value of the attribute as N<follows:>
!block example
my $arrayref = [ "se=hammer/fi=products/sf=description",
"se=plutonium/fi=products/sf=description", ];
$Tag->I<routine>( { search => $arrayref, } );
!endblock
Similarly to use a hash reference for the 'entry' attribute:
!block example
my $hashref = { name => "required",
date => 'default="%B %d, %Y"', };
$Tag->I<routine>( { entry => $hashref } );
!endblock
H1: Looping tags and Sub-tags
{{CMD[id="subtags"]}}Certain tags are not standalone; these are the
ones that are interpreted as part of a surrounding looping tag
like E<lbracket>{{CMD[jump="#loop"]loop}}], E<lbracket>{{CMD[jump="#item-list"]item-list}}], E<lbracket>{{CMD[jump="#query"]query}}], or E<lbracket>{{CMD[jump="#search-region"]search-region}}E<rbracket>.
. E<lbracket>{{CMD[jump="#PREFIX-accessories"]PREFIX-accessories}}]
. E<lbracket>{{CMD[jump="#PREFIX-alternate"]PREFIX-alternate}}]
. E<lbracket>{{CMD[jump="#PREFIX-calc"]PREFIX-calc}}]
. E<lbracket>{{CMD[jump="#PREFIX-change"]PREFIX-change}}]
. E<lbracket>{{CMD[jump="#PREFIX-code"]PREFIX-code}}]
. E<lbracket>{{CMD[jump="#PREFIX-data"]PREFIX-data}}]
. E<lbracket>{{CMD[jump="#PREFIX-description"]PREFIX-description}}] (Note C<safe-data> and C<ed()> escape)
. E<lbracket>{{CMD[jump="#PREFIX-discount"]PREFIX-discount}}]
. E<lbracket>{{CMD[jump="#PREFIX-discount-subtotal"]PREFIX-discount-subtotal}}]
. E<lbracket>{{CMD[jump="#PREFIX-field"]PREFIX-field}}] (Optimization note-- one query per field if you use this; we optimize around this if only one products table)
. E<lbracket>{{CMD[jump="#PREFIX-increment"]PREFIX-increment}}]
. E<lbracket>{{CMD[jump="#PREFIX-last"]PREFIX-last}}]
. E<lbracket>{{CMD[jump="#PREFIX-line"]PREFIX-line}}] (tab-delimited list of parameters returned)
. E<lbracket>{{CMD[jump="#PREFIX-modifier"]PREFIX-modifier}}]
. E<lbracket>{{CMD[jump="#PREFIX-next"]PREFIX-next}}]
. E<lbracket>{{CMD[jump="#PREFIX-param"]PREFIX-param}}]
. E<lbracket>{{CMD[jump="#PREFIX-pos"]PREFIX-pos}}]
. E<lbracket>{{CMD[jump="#PREFIX-price"]PREFIX-price}}]
. E<lbracket>{{CMD[jump="#PREFIX-quantity"]PREFIX-quantity}}]
. E<lbracket>{{CMD[jump="#PREFIX-subtotal"]PREFIX-subtotal}}]
. E<lbracket>{{CMD[jump="#if-PREFIX-data"]if-PREFIX-data}}]
. E<lbracket>{{CMD[jump="#if-PREFIX-field"]if-PREFIX-field}}]
. C<[if-PREFIX-param]>
. C<[if-PREFIX-pos]>
. E<lbracket>{{CMD[jump="#PREFIX-modifier-name"]modifier-name}}]
. E<lbracket>{{CMD[jump="#PREFIX-quantity-name"]quantity-name}}]
PREFIX represents the prefix that is used in that looping tag.
They are only interpreted within their container and only accept
positional parameters. The default prefixes:
!block table
Tag|Prefix|Examples
E<lbracket>{{CMD[jump="#loop"]loop}}]|loop|E<lbracket>loop-code], [loop-field price], [loop-increment]
E<lbracket>{{CMD[jump="#item-list"]item-list}}]|item|E<lbracket>item-code], [item-field price], [item-increment]
E<lbracket>{{C[jump="#search-list"]search-list}}]|item|E<lbracket>item-code], [item-field price], [item-increment]
E<lbracket>{{CMD[jump="#query"]query}}]|sql|E<lbracket>sql-code], [sql-field price], [sql-increment]
!endblock
Sub-tag behavior is consistent among the looping tags.
Subtags are parsed during evaluation of the enclosing loop, I<before>
any regular tags within the loop.
There are two types of looping lists: ARRAY and HASH.
An array list is the normal output of a E<lbracket>{{C[jump="#query"]query}}], a search, or a E<lbracket>{{C[jump="#loop"]loop}}]
tag. It returns from 1 to N C<return fields>, defined in the C<mv_return_fields>
or C<rf> variable or implicitly by means of a SQL field list. The two
queries below are essentially identical:
> [query sql="select foo, bar from products"]
> [/query]
>
> [loop search="
> ra=yes
> fi=products
> rf=foo,bar
> "]
Both will return an array of arrays consisting of the C<foo> column and
the C<bar> column. The Perl data structure would look like:
> [
> ['foo0', 'bar0'],
> ['foo1', 'bar1'],
> ['foo2', 'bar2'],
> ['fooN', 'barN'],
> ]
A hash list is the normal output of the [item-list] tag. It returns
the value of all return fields in an array of hashes. A normal [item-list]
return might look like:
> [
> {
> code => '99-102',
> quantity => 1,
> size => 'XL',
> color => 'blue',
> mv_ib => 'products',
> },
> {
> code => '00-341',
> quantity => 2,
> size => undef,
> color => undef,
> mv_ib => 'products',
> },
>
> ]
You can also return hash lists in queries:
> [query sql="select foo, bar from products" type=hashref]
> [/query]
Now the data structure will look like:
> [
> { foo => 'foo0', bar => 'bar0' },
> { foo => 'foo1', bar => 'bar1' },
> { foo => 'foo2', bar => 'bar2' },
> { foo => 'fooN', bar => 'barN' },
> ]
H2: PREFIX-accessories
E: E<lbracket>PREFIX-accessories arglistE<rbracket>
Except for the usual differences that apply to all subtags (such as
parsing order), these are more or less equivalent for an array-type
N<list:>
!block example
[accessories code=I<current_item_code> arg=I<arglist>]
[item-accessories I<arglist>]
!endblock
See the E<lbracket>{{C[jump="#accessories"]accessories}}] tag for more
detail. Note that you must use the comma-delimited list to set
attributesE<nbspace>E<emdash> you cannot set named attributes with the
usual 'attribute=value' syntax.
If the list is a hash list,
i.e. an E<lbracket>{{C[jump="#item-list"]item-list}}],
then the value of the current item hash is passed so that a value default
can be established.
H2: PREFIX-alternate
E: E<lbracket>PREFIX-alternate N] DIVISIBLE [else] NOT DIVISIBLE [/else][/PREFIX-alternate]
Set up an alternation sequence. If the item-increment is divisible by
`N', the text will be displayed. If an `[else]NOT DIVISIBLE TEXT[/else]'
is present, then the NOT DIVISIBLE TEXT will be displayed.
For example:
> [item-alternate 2]EVEN[else]ODD[/else][/item-alternate]
> [item-alternate 3]BY 3[else]NOT by 3[/else][/item-alternate]
There are some additional primitives:
!block table
Tag|Description
E<lbracket>item-alternate first_only]|Only true on first item
E<lbracket>item-alternate last_only]|Only true on last item
E<lbracket>item-alternate except_last]|True except on last item
E<lbracket>item-alternate except_first]|True except on last item
E<lbracket>item-alternate 0]|Same as "first_only"
E<lbracket>item-alternate -1]|Same as "except_last"
!endblock
In the common case where you want to separate by a comma or
other joiner:
> You have the following items:
> [item-list]
> [item-code][item-alternate except_last], [/item-alternate]
> [/item-list]
H2: PREFIX-calc
E: E<lbracket>PREFIX-calc] 2 + [item-field price] [/PREFIX-calc]
Executes Perl code in the tag body. This is equivalent to the
E<lbracket>{{C[jump="#calc"]calc}}] ... [/calc] tag pair, except it's
calculated at loop time instead of later when the rest of the page is parsed.
H2: PREFIX-change
E: E<lbracket>PREFIX-change][condition] ... [/condition] TEXT [/PREFIX-change]
Sets up a breaking sequence that occurs when the contents of
\[condition] [/condition] change. The most common one is a category
break to nest or place headers.
The region is only output when a field or other repeating value between
\[condition] and [/condition] changes its value. This allows indented lists
similar to database reports to be easily formatted. The repeating value
must be a tag interpolated in the search process, such as
E<lbracket>{{C[jump="#PREFIX-field"]PREFIX-field}}]
or E<lbracket>{{C[jump="#PREFIX-field"]PREFIX-field}}C< database field>].
If you need access to ITL tags, you can use
E<lbracket>{{C[jump="#PREFIX-calc"]PREFIX-calc}}] with a C<$Tag->foo()> call.
Of course, this will only work as you expect when the search results
are properly sorted.
The value to be tested is contained within a
C<[condition]value[/condition]> tag pair. The E<lbracket>C<PREFIX-change>E<rbracket> tag
also processes an C<[else] [/else]> pair for output when the value does
not change.
Here is a simple example for a search list that has a field C<category> and
C<subcategory> associated with each item:
> <TABLE>
> <TR><TH>Category</TH><TH>Subcategory</TH><TH>Product</TH></TR>
> [search-list]
> <TR>
> <TD>
> [item-change cat]
>
> [condition][item-field category][/condition]
>
> [item-field category]
> [else]
>
> [/else]
> [/item-change cat]
> </TD>
> <TD>
> [item-change sub]
>
> [condition][item-field subcategory][/condition]
>
> [item-field subcategory]
> [else]
>
> [/else]
> [/item-change sub]
> </TD>
> <TD> [item-field name] </TD>
> [/search-list]
> </TABLE>
The above should put out a table that only shows the category and
subcategory once, while showing the name for every product. (The C< >
will prevent blanked table cells if you use a border.)
H2: PREFIX-code
E: E<lbracket>PREFIX-code]
The key or code of the current loop.
In an E<lbracket>{{C[jump="#item-list"]item-list}}] this is always
the product code; in a loop list it is the value of the current argument;
in a search it is whatever you have defined as the first C<mv_return_field>
(C<rf>).
H2: PREFIX-data
E: E<lbracket>PREFIX-data table field]
Calls the column C<field> in database table C<table> for the current
E<lbracket>{{C[jump="#PREFIX-code"]PREFIX-code}}]
This may or may not be equivalent to
E<lbracket>{{C[jump="#PREFIX-field"]PREFIX-field}} field]
depending upon whether your search table is defined as one of the
{{C[jump="icconfig.html#ProductFiles"]ProductFiles}}.
H2: PREFIX-description
E: E<lbracket>PREFIX-description]
The description of the current item, as defined in the C<catalog.cfg> directive
C<DescriptionField>. In the demo, it would be the value of the field C<description>
in the table C<products>.
If the list is a hash list, and the lookup of C<DescriptionField> fails,
then the attribute C<description> will be substituted. This is useful to
supply shopping cart descriptions for on-the-fly items.
H2: PREFIX-discount
E: E<lbracket>PREFIX-discount]
The price of the current item is calculated, and the difference between
that price and the list price (quantity one) price is output. This may have
different behavior than you expect if you set the
E<lbracket>{{C[jump="#discount"]discount}}] tag along with quantity pricing.
H2: PREFIX-discount-subtotal
E: E<lbracket>PREFIX-discount-subtotal]
Inserts the discounted subtotal of the ordered items.
H2: PREFIX-field
E: E<lbracket>PREFIX-field]
Looks up a field value for the current item in one of several places,
in this order:
> 1. The first ProductFiles entry.
> 2. Additional ProductFiles in the order they occur.
> 3. The attribute value for the item in a hash list.
> 4. Blank
A common user error is to do this:
> [loop search="
> fi=foo
> se=bar
> "]
>
> [loop-field foo_field]
> [/loop]
In this case, you are searching the table C<foo> for a string
of C<bar>. When it is found, you wish to display the value of C<foo_field>.
Unless C<foo> is in
{{C[jump="icconfig.html#ProductFiles"]ProductFiles}}
and the code is not present in a previous
product file, you will get a blank or some value you don't want. What
you really want is
E<lbracket>{{C[jump="#PREFIX-data"]loop-data}}C< foo field>], which specifically
addresses the table C<foo>. See also E<lbracket>{{C[jump="#PREFIX-param"]PREFIX-param}}]
and E<lbracket>{{C[jump="#PREFIX-pos"]PREFIX-pos}}].
H2: PREFIX-increment
E: E<lbracket>PREFIX-increment]
The current count on the list, starting from either 1 in a zero-anchored
list like E<lbracket>{{C[jump="#loop"]loop}}] or E<lbracket>{{C[jump="#item-list"]item-list}}], or from the match count in a
search list.
If you skip items with E<lbracket>{{C[jump="#PREFIX-last"]PREFIX-last}}]
or E<lbracket>{{C[jump="#PREFIX-next"]PREFIX-next}}], the count is NOT
adjusted.
H2: PREFIX-last
E: E<lbracket>PREFIX-last] CONDITION [/PREFIX-last]
If CONDITION evaluates true (a non-whitespace value that is not specifically
zero) then this will be the last item displayed.
H2: PREFIX-line
E: E<lbracket>PREFIX-line start_column]
Returns all array values from the current looping row in a single string, with each value separated by a tab, roughly equivalent to this:
E: E<lbracket>PREFIX-pos 0](tab)[PREFIX-pos 1](tab)[PREFIX-pos 2](tab)[...]
for however many fields were returned in that row.
This is useful as a quick way to see all your results at a glance and verify your search specification.
If the optional C<start_column> attribute is given, the output starts with that column instead of column 0.
H2: PREFIX-modifier
E: E<lbracket>PREFIX-modifier attribute]
If the item is a hash list (i.e.
E<lbracket>{{C[jump="#item-list"]item-list}}]), this will return the value
of the C<attribute>.
H2: PREFIX-next
E: E<lbracket>PREFIX-next] CONDITION [/PREFIX-next]
If CONDITION evaluates true (a non-whitespace value that is not specifically
zero) then this item is skipped.
H2: PREFIX-param
E: E<lbracket>PREFIX-param name]
Returns the value of the column name associated with the looping tag row.
Each looping list returns an array of C<return fields>, set in searches with
C<mv_return_field> or C<rf>. The default is only to return the code of
the search result, but by setting those parameters you can return
whichever columns you wish.
In a E<lbracket>{{C[jump="#query"]query}}] ITL tag you can select multiple
return fields with something like:
> [query prefix=prefix sql="select foo, bar from baz where foo='buz'"]
> [prefix-code] [prefix-param foo] [prefix-param bar]
> [/query]
In this case, E<lbracket>{{C[jump="#PREFIX-code"]prefix-code}}]
and [prefix-param foo] are synonyms, as C<foo> is the first returned
parameter and becomes the code for this row.
Another synonym is E<lbracket>{{C[jump="#PREFIX-pos"]prefix-pos}} 0].
Mixed case field names in your SQL tables will be forced to lower case in the E<lbracket>prefix-param name] tag if the underlying Database does that (as with most
SQL types). For example if your query is
> [query prefix=prefix sql="select Foo, Bar from baz where Foo='buz'"]
then you must use:
> [prefix-param foo] and [prefix-param bar]
to display your results, rather than:
> [prefix-param Foo] and [prefix-param Bar]
Note that the following code is invalid:
> [query prefix=prefix sql=|
> SELECT table1.foo,
> table2.bar
> FROM table1, table2
> WHERE table1.code = table2.code
> AND table1.foo = 'buz'
> |]
> [prefix-param table1.foo] [prefix-param table2.bar]
> [/query]
The problem with the above code is that DBI doesn't support column names
such as C<table1.foo> in its resultsets. The following query syntax is
fully supported by DBI and therefore by Interchange:
> [query prefix=prefix sql=|
> SELECT table1.foo AS foo,
> table2.bar AS bar
> FROM table1, table2
> WHERE table1.code = table2.code
> AND table1.foo = 'buz'
> |]
> [prefix-param foo] [prefix-param bar]
> [/query]
H2: PREFIX-pos
E: E<lbracket>PREFIX-pos N]
Returns the value of the array parameter associated with the looping tag row. Each looping list returns an array of C<return fields>, set in searches with
C<mv_return_field> or C<rf>. The default is only to return the code of
the search result, but by setting those parameters you can return
whichever columns you wish.
E<lbracket>PREFIX-pos N] outputs the data from the I<N>th column as returned
(starting with zero).
E<lbracket>{{C[jump="#PREFIX-param"]PREFIX-param}}] lets you access the data
by column name instead of by number.
In a E<lbracket>query ...] ITL tag you can select multiple return fields with
something like:
> [query prefix=prefix sql="select foo, bar from baz where foo='buz'"]
> [prefix-code] [prefix-param foo] [prefix-param bar]
> [/query]
In this case, E<lbracket>{{C[jump="#PREFIX-code"]prefix-code}}]
and E<lbracket>{{C[jump="#PREFIX-param"]prefix-param}} foo] are synonyms,
as C<foo> is the first returned parameter and becomes the code for this row.
Another synonym is [prefix-pos 0]. [prefix-pos 1] is the same as
E<lbracket>{{C[jump="#PREFIX-param"]prefix-param}} bar]. The following code
will produce exactly the same output as the above:
> [query prefix=prefix sql="select foo, bar from baz where foo='buz'"]
> [prefix-pos 0] [prefix-pos 0] [prefix-pos 1]
> [/query]
Note that if you use the [PREFIX-pos] tag, you may have to review your column
numbers whenever you modify the columns you select. For this reason, queries
that make use of the E<lbracket>{{C[jump="#PREFIX-param"]PREFIX-param}}] tag
may be easier to maintain and will be less prone to future surprises.
H2: PREFIX-price
E: E<lbracket>PREFIX-price]
The price of the product identified by the current code, formatted for currency. If
Interchange's pricing routines cannot determine the price (i.e. it is not
a valid product or on-the-fly item) then zero is returned. If the list
is a hash list, the price will be modified by its C<quantity> or other
applicable attributes (like C<size> in the demo).
H2: PREFIX-quantity
E: E<lbracket>PREFIX-quantity]
The value of the C<quantity> attribute in a hash list. Most commonly
used to display the quantity of an item in a shopping cart
E<lbracket>{{C[jump="#item-list"]item-list}}].
H2: PREFIX-subtotal
E: E<lbracket>PREFIX-subtotal]
The E<lbracket>{{C[jump="#PREFIX-quantity"]PREFIX-quantity}}]
times the E<lbracket>{{C[jump="#PREFIX-price"]PREFIX-price}}].
This does take discounts into account.
H2: if-PREFIX-data
E: E<lbracket>if-PREFIX-data table field] IF text [else] ELSE text [/else] [/if-PREFIX-data]
Examines the data field, i.e. [PREFIX-data table field], and if it is
non-blank and non-zero then the C<IF text> will be returned. If it is false,
i.e. blank or zero, the C<ELSE text> will be returned to the page.
This is much more efficient than the otherwise equivalent
E<lbracket>{{C[jump="#if"]if}} C<type=data term=table::field::>E<lbracket>{{C[jump="#PREFIX-code"]PREFIX-code}}]].
You cannot place a condition;
i.e. C<[if-PREFIX-data table field eq 'something']>.
Use E<lbracket>{{C[jump="#if"]if}}C< type=data> ...] for that.
Careful, a space is not a false value!
H2: if-PREFIX-field
E: E<lbracket>if-PREFIX-field field] IF text [else] ELSE text [/else] [/if-PREFIX-field]
Same as E<lbracket>{{C[jump="#if-PREFIX-data"]if-PREFIX-data}} ...]
except uses the same data rules as
E<lbracket>{{C[jump="#PREFIX-field"]PREFIX-field}}].
# H2: {{CMD[id="PREFIX-modifier-name"]PREFIX-modifier-name}}
H2: PREFIX-modifier-name
E: E<lbracket>PREFIX-modifier-name attribute]
Outputs a variable name which will set an appropriate variable name for setting
the attribute in a form (usually a shopping cart). Outputs for successive items
in the list:
> 1. attribute0
> 2. attribute1
> 3. attribute2
etc.
C<[PREFIX-modifier-name quantity]>
would be the same as
E<lbracket>{{C[jump="#PREFIX-quantity-name"]PREFIX-quantity-name}}].
# H2: {{CMD[id="quantity-name"]PREFIX-quantity-name}}
H2: PREFIX-quantity-name
E: E<lbracket>item-quantity-name]
Outputs for successive items in the list:
> 1. quantity0
> 2. quantity1
> 3. quantity2
etc.
E<lbracket>{{C[jump="#PREFIX-modifier-name"]PREFIX-modifier-name}}C< quantity>]
would be the same as C<[PREFIX-quantity-name]>.
H1: Tags
Each ITL tag is show below. Calling information is defined for the main tag,
sub-tags are described in
{{CMD[jump="#Looping tags and Sub-tags"]Looping tags and Sub-tags}}.
H2: accessories
A Swiss-army-knife widget builder, this provides access to
Interchange's product option attributes (e.g., to choose or access
product options such as a shirt's size or color).
Can build selection objects (radio, check, select boxes, etc), forms
or hyperlinks, or can simply return a value.
Or moreE<nbspace>E<emdash> see also {{CMD[jump="#Looping tags and Sub-tags"]Looping tags and Sub-tags}}.
H3: Summary
!block example;
[B<accessories> code arg]
[B<accessories> code=[[EXAMPLE_SKU]] arg="size, radio, ... " I<other_named_attributes>] I<deprecated>
[B<accessories> code=[[EXAMPLE_SKU]] attribute=size type=radio ... I<other_named_attributes>]
!endblock
!block table; colvaligns="TTT"; format="262"
Parameters|Description|Default
{{CMD[jump="#accessories_code"]code}}|<<
Value of the master key in the product (or specified other) table
>>|I<none>
{{CMD[jump="#accessories_arg"]arg}}|<<
Positionally interpreted comma-delimited list of values for the
following N<attributes:>
. "attribute, type, column, table, name, outboard, passed"
>>|I<none>
!endblock
!block table; colvaligns="TT"
Attributes|Default
{{CMD[jump="#accessories_attribute"]attribute}}|I<none>
<<
{{CMD[jump="#accessories_type"]type}}
. One of select, value, text, textarea, hidden, password, combo,
move_combo, reverse_combo, show, options, labels, checkbox, radio, links
>>|select
{{CMD[jump="#accessories_column"]column}}|I<attribute>
{{CMD[jump="#accessories_table"]table}}|products
{{CMD[jump="#accessories_name"]name}}|mv_order_I<attribute>
{{CMD[jump="#accessories_outboard"]outboard}}|I<none>
{{CMD[jump="#accessories_passed"]passed}}|I<none>
{{CMD[jump="#accessories_code"]key}} (alias for code)|I<none>
{{CMD[jump="#accessories_code"]row}} (alias for code)|I<none>
{{CMD[jump="#accessories_table"]base}} (alias for C<table>)|products
{{CMD[jump="#accessories_table"]database}} (alias for C<table>)|products
{{CMD[jump="#accessories_table"]db}} (alias for C<table>)|products
{{CMD[jump="#accessories_column"]col}} (alias for C<column>|I<attribute>
{{CMD[jump="#accessories_column"]field}} (alias for C<column>|I<attribute>
{{CMD[jump="#accessories_delimiter"]delimiter}}|comma (',')
{{CMD[jump="#accessories_prepend"]prepend}}|I<none>
{{CMD[jump="#accessories_append"]append}}|I<none>
{{CMD[jump="#accessories_extra"]extra}}|I<none>
{{CMD[jump="#accessories_js"]js}}|I<none>
{{CMD[jump="#accessories_rows"]rows}}|I<varies with >C<type>I<; often> 4
{{CMD[jump="#accessories_cols"]cols}}|I<varies with >C<type>I<; often> 40
{{CMD[jump="#accessories_width"]width}}|I<none>
{{CMD[jump="#accessories_default"]default}}|I<none>
{{CMD[jump="#accessories_price"]price}}|I<none>
{{CMD[jump="#accessories_price_data"]price_data}}|I<none>
{{CMD[jump="#accessories_contains"]contains}} (C<type>=radio or check)|I<none>
{{CMD[jump="#accessories_joiner"]joiner}} (C<type>=links)|I<none>