[ic] [loop search=] inside a [page scan=]

Dan db@cyclonehq.dnsalias.net
Thu, 14 Dec 2000 20:54:49 -0800


Thanks again Joachim.  I'm learning a lot, trust me.  I'll run through some
questions in your e-mail pretty quick, and then I'll provide some more
information.  This time I'll actually copy and paste the code.  :-)  I would
be happy for anyone lurking this thread to pipe in with "Read these chapters
from the docs over and over again: ___, ___, and ___" -- if any docs come to
mind regarding my current "issue".

> > > [seti dummy][loop search="st=db/fi=favorites/se=[scratch
> > user_favorite]/sf=product_sku"][loop-data favorites
product_sku]|[/loop]nada
>                                         What is this??? --->      ^
>                                         A PIPE-Symbol?

Yes, it's a pipe symbol.  I use the pipe symbol for "OR" type searches
(possible when using co=yes).  For example, the following works fine:

[page scan
fi=products/sp=results/st=db/co=yes/sf=sku/se="771100|10325|10341|10372|5054
00-6|97402|770001|nada"]Products that are your favorite type![/page]

HTML output of the above:
<a
href="http://localhost/cgi-bin/ds25/scan/fi=products/sp=results/st=db/co=yes
/sf=sku/se=%22771100%7c10325%7c10341%7c10372%7c505400%2d6%7c97402%7c770001%7
cnada%22.html">Products that are your favorite type!</A>

Which is fine.

> > > Test: [scratch dummy]<BR>
> > > and
> > >
> > >  [page scan INTERPOLATE=1
>
> Oh? Remove "INTERPOLATE=1" and try it again!


It seems that whether I use interpolate=1 or not, it behaves the same.  But
I'll try it both ways.  (See below)


> > >   fi=products
> > >   sp=results
> > >   st=db
> > >   co=yes
> > >   sf=sku
> > >   se=[scratch dummy]
> > >  ]
> > >  Click here to see a list of your favorite products!
> > >  [/page]
> >
> > I tried that, but the result I got was:
> > <A HREF=".../se=[scratch dummy.html">Click here to see a list of your
> > favorite products!</A>
>
> ? Why [scratch dummy.html] instead of [scratch dummy.html]?
> Is this comming from


When you use [page] or [area], Interchange automatically adds a .html to
then end of your <A ...> text.  (e.g. [area files] becomes <A
HREF="files.html">).  I didn't write dummy.html anywhere.


> [seti dummy][loop search="st=db/fi=favorites/se=[scratch
> user_favorite]/sf=product_sku"][loop-data favorites
> product_sku]|[/loop]nada
>
> Did you use [seti dummy.html]...[/seti]?
> I'm in a muddle!


no, I didn't use [seti dummy.html], I did [seti dummy].


> > previously tried the equivalent of what you suggested, except I used
[set]
> > instead of [seti], and [set] didn't work either.
>
> You want to use a variable. It will not set at the first time. With
> [set], you have to use
>
> [set name="dummy" interpolate=1]
>
> will be set the variable first and this is the same as [seti].

Now I can see the difference.  I'll just use [seti] then.

Here is some more information, all cut-and-pasted:  :-)

***************************************************************
Here is some background information on the database itself:
ds=# SELECT * FROM favorites;
 favorite_id | favorite_type | product_sku
-------------+---------------+-------------
           1 |             2 | 771100
           2 |             2 | 10325
           3 |             2 | 10341
           4 |             3 | 10372
           5 |             5 | 505400-6
           6 |             7 | 97402
           7 |             2 | 770001
(7 rows)
***************************************************************
Here is some code and it's output.  I'll step through each section of code
on the way down the entire page.
    CODE:
[seti user_favorite_type]2[/seti]
Your favorite type of product: [scratch user_favorite_type]<BR>
    OUTPUT:
Your favorite type of product: 2
***************************************************************
    CODE:
[seti favorite_products][loop search="st=db/fi=favorites/se=[scratch
user_favorite_type]/sf=favorite_type"][loop-data favorites
product_sku]|[/loop]nada[/seti]
Test listing of your favorite products: [scratch favorite_products]<BR>

[page scan
fi=products/sp=results/st=db/co=yes/sf=sku/se="771100|10325|10341|10372|5054
00-6|97402|770001|nada"]Products that are your favorite type![/page]<BR>
    OUTPUT:
Test listing of your favorite products: 771100|10325|10341|770001|nada
Products that are your favorite type!
    NOTES:
The abovelink correctly displays products that have the above product_sku's.
***************************************************************
    CODE:
[page scan fi=products/sp=results/st=db/co=yes/sf=sku/se=[scratch
favorite_products]]Products that are your favorite type![/page]
    OUTPUT:
]Products that are your favorite type!
    HTML OUTPUT:
<a
href="http://localhost/cgi-bin/ds25/scan/fi=products/sp=results/st=db/co=yes
/sf=sku/se=%5bscratch%20favorite_products.html">]Products that are your
favorite type!</A>
    NOTES:
This is the part that doesn't work.  You can kind of tell that instead of
putting in the contents of [scratch favorite_products], it just writes
[scratch ... as part of the link (which of course doesn't work).  It doesn't
help if I set interpolate=1, either.
***************************************************************
For your information, here is all the code and all the output in one fell
swoop.
    CODE:
[seti user_favorite_type]2[/seti]
Your favorite type of product: [scratch user_favorite_type]<BR>
[seti favorite_products][loop search="st=db/fi=favorites/se=[scratch
user_favorite_type]/sf=favorite_type"][loop-data favorites
product_sku]|[/loop]nada[/seti]
Test listing of your favorite products: [scratch favorite_products]<BR>
[page scan
fi=products/sp=results/st=db/co=yes/sf=sku/se="771100|10325|10341|10372|5054
00-6|97402|770001|nada"]Products that are your favorite type![/page]<BR>
[page scan fi=products/sp=results/st=db/co=yes/sf=sku/se=[scratch
favorite_products]]Products that are your favorite
type![/page]<BR>[comment]Doesn't work yet[/comment]
    OUTPUT:
Your favorite type of product: 2
Test listing of your favorite products: 771100|10325|10341|770001|nada
Products that are your favorite type!
]Products that are your favorite type!
    HTML OUTPUT:

Your favorite type of product: 2<BR>

Test listing of your favorite products: 771100|10325|10341|770001|nada<BR>
<a
href="http://localhost/cgi-bin/ds25/scan/fi=products/sp=results/st=db/co=yes
/sf=sku/se=%22771100%7c10325%7c10341%7c10372%7c505400%2d6%7c97402%7c770001%7
cnada%22.html">Products that are your favorite type!</A><BR>
<a
href="http://localhost/cgi-bin/ds25/scan/fi=products/sp=results/st=db/co=yes
/sf=sku/se=%5bscratch%20favorite_products.html">]Products that are your
favorite type!</A><BR>
***************************************************************


Again, I really apprecaite your help, Joachim.  I wouldn't feel so retarded
if this wasn't such an easy problem (or so it seems it should be).  Maybe
someone could pipe in with "Read these chapters from the docs over and over
again: ___, ___, and ___".

Thanks,

Dan Browning - danb@cyclonecomputers.com