HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Organised Quote System

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#997 (In Topic #244)

Fan in action

Organised Quote System

This is very easy to do. What this does is modifies the quote code section to look for quotes in multiple files instead of just one. I personally like it since it keeps my quotes more organised.

Download start.php from [your website]/pages/ and make a backup copy of it.

Look for:

Code

// Quote
if ($is_on_quote==1)
{
   put_in_table(smile(get_random_line("text/quotes.txt")),"width='100%'",0,"Random Quote");
   echo "<br />";
}

Replace it with:

Code

// Quote
if ($is_on_quote==1)
{
   $selectquote=get_random_line("text/quotes.txt");

   if (trim($selectquote) == "Something") { put_in_table(get_random_line("text/quotes_something.txt"),"width='100%'",0,"Random Something Quote"); }
   echo "<br />";
}

I recommend using files which start with " quotes_ " as it will appear right next to each other in the admin center.

Replace Something with anything you want. The == "Something" doesn't have to match the filename…

Once you have all your files associated with a word, Add those words in quotes.txt.

Something like this:

Originally posted by start.php+–></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (start.php)</td></tr><tr><td id='QUOTE'>// Quote
if ($is_on_quote==1)
{
   $selectquote=get_random_line("text/quotes.txt");

   if (trim($selectquote) == "Something_A") { put_in_table(get_random_line("text/quotes_something_a.txt"),
"width='100%'",0,"Random Something_A Quote"); }
   if (trim($selectquote) == "Something_B") { put_in_table(get_random_line("text/quotes_something_b.txt"),
"width='100%'",0,"Random Something_B Quote"); }
   if (trim($selectquote) == "Something_C") { put_in_table(get_random_line("text/quotes_something_c.txt"),
"width='100%'",0,"Random Something_C Quote"); }
   echo "
";
}
(^^ might be a good idea to have each { } on one line… ;))

<!–QuoteBegin-quotes.txt
Something_A
Something_B
Something_C
Something_A
Something_B
Something_C
Something_A
Something_B
Something_C


You could just add one of each if you want, but the more there are seems to make it even more random… :dry:

Think of it like this: Picking one person from a group of 2 people at random. Picking one person from a group of 20 people at random. :)

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: