[TYPO3] Random Text + Image ... 100% SOLVED!!!

Scotty C superscotty19 at yahoo.com
Wed Jun 14 07:06:08 CEST 2006


Ryan,

AFAIK, this method will work with any content element
(I've only tried it with "text" and text w/image" so
far, but the theory makes sense).

Now, for the code breakdown, I'm far from an expert in
this, but I'll try. Here's the whole thing, with
comments:

// subparts.FEATURE is a label for the spot in the 
// HTML where I want the elements to appear
// COA_INT is a non-chached version of the COA element
// (refer to the TS ref for more info)
subparts.FEATURE = COA_INT
subparts.FEATURE {

   // use the CONTENT type when generating content
   // (as opposed to just statically inserting it
here)
   10 = CONTENT
   10 {

      // for an explanation of what's going on here,
      // check this link:
      //
http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/8/9/
      table = tt_content

      // use a little bit of SQL ...
      select {
   
         // The PID of the page which stores the 
         // content (in my case, 1092)
         pidInList = 1092

         // only display 1 element at a time
         max = 1

         // this is the part that makes the magic! 
         // Random generation!
         orderBy = rand()
      }
   }
}


Hope this helps,
-Scott.



--- Ryan Off <ryan at ryanoff.com> wrote:

> Will this also work for images as is? Is it possible
> to add some more  
> explanation about how it works so this bit of code
> will be easily  
> used by the rest of the Typo3 community?
> 
> Ryan
> 
> 
> 
> On 13 Jun 2006, at 20:57, Scotty C wrote:
> 
> > YAAYYY!!!!
> >
> > You did it!!!!
> > Tapio, Joey, thanks to your help, I now have a
> > *completely extension independent* method of
> > displaying random content of ANY type on every
> page!!!
> >
> > This is truly an historic day in the world of
> Typo3
> > (or at least in my world, hehe)!
> >
> > Thank you so much!
> > -Scott.
> > P.S. My previous comments about loving the
> > community/open source/Typo3 still hold ;-)
> >
> >
> >
> > --- JoH <info at cybercraft.de> wrote:
> >
> >>>>> However, the result is that it's displaying
> all
> >>>> the
> >>>>> random content elements at once (which makes
> >> sense
> >>>>> because I haven't told it to use the plugin).
> My
> >>>>> question now is, how do I plug in the
> >>>> "randomcontent"
> >>>>> extension so that it parses all the content
> and
> >>>> just
> >>>>> displays one element at a time?
> >>>>
> >>>> subparts.FEATURE = CONTENT
> >>>> subparts.FEATURE {
> >>>>     table = tt_content
> >>>>     select {
> >>>>         pidInList = 1092
> >>>>         max = 1
> >>>>         orderBy = rand()
> >>>>     }
> >>>> }
> >>>>
> >>>> Should do the job.
> >>>
> >>> I tried that and it "kind of" worked. The result
> >> was
> >>> that the first content element in the "random
> >> content"
> >>> page appeared, but that's it. The elements did
> not
> >>> cycle (even though we told it to cycle
> randomly).
> >>
> >> subparts.FEATURE = COA_INT
> >> subparts.FEATURE {
> >>     10 = CONTENT
> >>     10 {
> >>         table = tt_content
> >>         select {
> >>             pidInList = 1092
> >>             max = 1
> >>             orderBy = rand()
> >>         }
> >>     }
> >> }
> >>
> >> To make sure, that the subpart is not taken from
> >> cache but rendered each
> >> time the page is loaded.
> >>
> >> Joey
> >>
> >> -- 
> >> Wenn man keine Ahnung hat: Einfach mal Fresse
> >> halten!
> >> (If you have no clues: simply shut your knob
> >> sometimes!)
> >> Dieter Nuhr, German comedian
> >> openBC: http://www.cybercraft.de
> >>
> >>
> >> _______________________________________________
> >> TYPO3-english mailing list
> >> TYPO3-english at lists.netfielders.de
> >>
> >
>
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
> >>
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> > _______________________________________________
> > TYPO3-english mailing list
> > TYPO3-english at lists.netfielders.de
> >
>
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
> 
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.netfielders.de
>
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the TYPO3-english mailing list