[Typo3] random quotes documentation?

Birk tlist at birkit.com
Tue Sep 27 14:31:53 CEST 2005


I looked into the randomness of random quotes and came up with the 
following.
Please forgive me if I'm saying somthing dumb here..I am new to 
extention coding :)

There did not seem (to me) to be anything random about the quotes_database.
The function makelist($res) was simply listing all of my quotes.
I altered the function class.tx_t3quotes_pi1 from:

function makelist($res)    {
        $items=Array();
            // Make list table rows
        while($this->internal["currentRow"] = mysql_fetch_assoc($res))    {
            $items[]=$this->makeListItem();
        }
   
        $out = '<DIV'.$this->pi_classParam("listrow").'>
            '.implode(chr(10),$items).'
            </DIV>';
        return $out;
    }
   
To:

function makelist($res)    {
        $items=Array();
            // Make list table rows
        while($this->internal["currentRow"] = mysql_fetch_assoc($res))    {
            $items[]=$this->makeListItem();
        }
        *$a = count($items)- 1;
        $b = rand(0, $a);
        $items[$b]=$this->makeListItem();*
        $out = '<DIV'.$this->pi_classParam("listrow").'>
            '.implode(chr(10),$items).'
            </DIV>';
        return $out;
    }

Now the funtion only returns one entry from the array..which is what I 
wanted.
I doubt this is the correct way to do this so if anyone knows a better 
way please fill me in!
L. 

Eric Blom wrote:

>I installed the extension once and tried to use it. I think the  
>problem I had was that the quote would never change. I searched the  
>mailing list and found two instances of the same question, but, never  
>an answer. If you find the answer will you please reply to this topic  
>with the information you found.
>
>Thanks,
>Eric
>  
>



More information about the TYPO3-english mailing list