[ic] User Defined Tag?

Jason Kohles interchange-users@interchange.redhat.com
Tue Dec 11 17:12:01 2001


On Tue, Dec 11, 2001 at 09:45:17PM +0000, Steve Graham wrote:
> 
> I need a macro or something, not sure what it is called, to replace the 
> following code with a one or two line call. I can probably use the User 
> Define Tag, but am not a Perl programmer (yet). Didn't know if I had another 
> choice.
> 
> Many of my custom pages will use this same code with the exception of the 
> price.group match (eg. "CALWB"), which will be different on each page. Hope 
> this makes sense.
> 
Try putting this in a file called thing.tag in your usertag directory, then
restart interchange (if you want to call it something else other than thing,
just change the references to 'thing'), then in your page, just put:
[thing CALWB] for example...  Check the UserTag documentation for more detail
on how this works

--------- cut here -----------
UserTag thing Order price_group
UserTag thing Interpolate 1
UserTag thing addAttr
UserTag thing Routine <<EOR
sub {
return <<"END";

<table border="1" width="100%">
<tr>
<td align=center>Example Image</td>
<td align=center>Description</td>
<td align=center> Single Unit Price </td>
</tr>

[query sql="select * from products,pricing where products.sku = pricing.sku 
AND pricing.price_group='$opt->{price_group}' ORDER BY products.description"
type=list]
[list]
<tr>
<td align=center>
[page [sql-code]]<IMG SRC="thumb/[sql-param thumb]" border=0><br>sku#
[sql-code]<br><font size=1>Click for more Info</font></a></td>
<td align=center>[sql-param description]</td>
<td align=center>[sql-price]</td>
</tr>
[/list]
[/query]
</table>
END
}
EOR
--------- cut here -----------

-- 
Jason Kohles                                 jkohles@redhat.com
Senior System Architect                      (703)786-8036 (cellular)
Red Hat Professional Consulting              (703)456-2940 (office)