[ic] feasibility of random components - [SOLVED]

Aaron Hazelton interchange-users@interchange.redhat.com
Mon Apr 29 12:29:00 2002


> > I need some input on this idea, to see if it would even be 
> feasible, and
> > perhaps more importantly, (somewhat) simple to do.  Maybe 
> someone has
> > done this or has another solution.
> >
> > Im thinking about having components on some pages be random.  -- One
> > time you visit this page, it might show specials, the next time you
> > visit it might show "tips" or "testimonials" components or whatever
> > else.  Here's my idea on maybe how to do it:
> >
> > = put the "random" component in each page you want this done in.
> 
> 
> 
> Hi, Ed Lafrance just helped me out with something similar. We 
> made a table
> called list.txt, and in that, made a table of "includes" like:
> 
> include
> file1.txt
> file2.txt
> file3.txt
> 
> Then in a page you can:
> 
> [loop
>           random=1
>           search="
>                   fi=list
>                   st=db
>                   ra=yes
>                   ml=1000
>           "
> ]
> here is the randon result:<br>
> [include file="path/to/random_file/dir/[loop-code]"]
> [/loop]
> 
> In that directory, just put file1.txt, file2.txt....... These 
> txt files
> would include the html that you want to "include". I suppose 
> that this html
> could have a component, like specials.
> 
> ...I suppose.
> 
> 
> Paul
> 
Thanks Paul and thanks Ed!  For those interested, here's what I did, and
its working perfect:

Set up NEW table called "rand_comp" like this

Code     |     include
--------------------
00001         feature1
00002         feature2
00003         testimonial
Etc.................

Set up component: "random_component"
[loop
          random=1
          search="
                  fi=rand_comp
                  st=db
                  ra=yes
                  ml=1000
                  rf=code,include
          "]

[include file="templates/components/[loop-param include]"]
[/loop]

Insert "random_component" into pages...

Isn't Interchange cool!?!...

  _____  

Sincerely,
Aaron Hazelton
>>Hazenet<<
aaron@hazenet.net