Page 1 of 1

[MOD] Random quotes block - improved

PostPosted: Sat May 20, 2006 9:40 am
Author: evolver

Re: [MOD] Random quotes block

PostPosted: Sat May 20, 2006 10:11 am
Author: evolver
You can simply replace the files, if you already had them installed.
If not, you can make them from the codes I provided...(it contains all files needed)

Re: [MOD] Random quotes block - improved

PostPosted: Sun May 21, 2006 3:13 pm
Author: evolver
And for managing quotes...

When you want to add quotes to the file,
how do you know if it's not already there?
You can always use search to look for a double,
but that might take a lot of time for each quote...

I have made an excel file to help me with that...
It helps to sort all your quotes by text or name.
Just copy and past them on the first page from the excel-file.
Sorting can be done before the last page...
(sort first on column A, secondly on B or C)
The sorted result on the last page can then simply be copied and pasted to the quotes-textfile.
You can download it [url=http]HERE[/url]. <img>

Re: [MOD] Random quotes block - improved

PostPosted: Mon May 29, 2006 6:22 am
Author: Dr. Bantham
A great Block made greater!

I have long been using the Random Quotes Block to display author quotations on my IM site. Before, I had to insert formatting code wrapped around the quotation source at the end of each line. I really appreciate the clean approach of this mod and the flexibility it allows.

I have modified the code further to introduce a third database variable which represents the source of the quotation. For my site, it is important to reference the author and the source. The source, in my instance, would equal the story from which the quotation was culled.

My code for blocks/blocks_imp_quotes.php:
Code: Select all
<?php /*************************************************************************** * blocks_imp_online_users.php * ------------------- * begin ]http://www.integramod.com[/url] * email : <a>webmaster@integramod.com</a> * * note: removing the original copyright is illegal even you have modified * the code. Just append yours if you have modified it. ***************************************************************************/  /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/  if ( !defined('IN_PHPBB') ) { die("Hacking attempt"); }  srand ((double) microtime() * 1000000);    // First we need some info about the quotes-file // --------------------------------------------- // Filename $zitate = file("quotes.txt"); // How long is that file? $filelength = count($zitate)-1;     // PHP sees the first line as line 0     // while we would see that as line 1 on an editor  // How many lines about one qoute? $onequote = 3; // Quotes starting from line $quotestart = 7-1;     // Because PHP starts from 0, we have to take 1 line less // Quotes ending at line $quoteend = $filelength-$quotestart; // Quotations $quotelines = $quoteend-$quotestart; $quoteamount = $quotelines/$onequote;  // Taking one random quote from the amount of quotes $i = $quoteamount-1; $randomquote = rand(0,$quoteamount);     // Here again, by starting from 0 we have to take 1 from the amount  // Random quote location $zitatetext = ($randomquote*$onequote)+$quotestart;     // Here, 0 comes in very handy to keep the first quote possible // Author location $zitateauthor = $zitatetext+1; // Quotation source $zitatesource = $zitatetext+2;    $template->assign_vars(array(     'QUOTE' => $zitate[$zitatetext],     'FROM' => $zitate[$zitateauthor],     'SOURCE' => $zitate[$zitatesource] )) ?>

My code for templatesfisubiceblocksquotes_block.tpl:
Code: Select all
<table>  <tr>   <td><img></td>   <td><span><br>         <b>&quot;</b>{QUOTE}<b>&quot;</b><br> </tr> <tr>   <td><div><em>{FROM} - &quot;{SOURCE}&quot;</em></div></td></td> </tr> </table>
I am not including the referenced image images/homepict2.jpg as it is custom to my site and would not apply otherwise.

My quotes.txt simply includes an additional line after the quotation and author, which represents the {SOURCE} variable]// This file holds the quotes for the random quotes block // // // // // The block code has been altered to not use the first 6 lines We leave this behind in your capable hands, for in the black-foaming gutters and back alleys of paradise, in the dank windowless gloom of some galactic cellar, in the hollow pearly whorls found in sewerlike seas, in starless cities of insanity, and in their slums . . . my awe-struck little deer and I have gone frolicking. Thomas Ligotti The Frolic De Plancy's <i>Dictionnaire Infernal</i> characterizes these demons, in the words of an unknown translator, as the one who glistens horribly like a rainbow of insects; the one who quivers in a horrible manner; and the one who moves with a particular creeping motion. Thomas Ligotti[/code]Note that the CODE reference above is wrapping text. There are no hard returns within the file.

I do have a couple of minor issues with my template that you might be able to help out with:[list type=decimal][*]The <b> tags are not taking for the quotation marks around the quotation itself. I tried the <strong> tag as well, to no avail. I would rather use text than the images you provided, as I wish for these to match the template style rather than be a graphic image which must be changed to match each template.[*]A singular space is being added to each quotation and source, just prior to the closing quotation mark. (See Below)[/list]
"Nevertheless, while I was deprived of the privilege of a natural rest, there may have also been some profit gained: the awful opulence of the dream, a rich and swollen world nourished by the exhaustion of the flesh. The world, in fact, as such. Any other realm seemed an absence by comparison, at best a chasm in the fertile graveyard of life. "
[align=center:1z9f4xul]Thomas Ligotti - "Mrs. Rinaldi's Angel "[/align:1z9f4xul]

I am not nearly as proficient as you are with Excel. If it is not too much trouble, it would be greatly appreciated if you would modify your spreadsheet to accommodate the third variable. It is a wonderful asset to this block! Again, thanks for sharing this with us!

Re: [MOD] Random quotes block - improved

PostPosted: Mon May 29, 2006 8:29 am
Author: evolver
"Dr. Bantham";p="7725" wrote:A great Block made greater!

I'm glad you like it :wink:

"Dr. Bantham";p="7725" wrote:I do have a couple of minor issues with my template that you might be able to help out with:[list type=decimal][*]The &lt;b&gt; tags are not taking for the quotation marks around the quotation itself. I tried the &lt;strong&gt; tag as well, to no avail. I would rather use text than the images you provided, as I wish for these to match the template style rather than be a graphic image which must be changed to match each template.[*]A singular space is being added to each quotation and source, just prior to the closing quotation mark. (See Below)[/list]
&quot;Nevertheless, while I was deprived of the privilege of a natural rest, there may have also been some profit gained: the awful opulence of the dream, a rich and swollen world nourished by the exhaustion of the flesh. The world, in fact, as such. Any other realm seemed an absence by comparison, at best a chasm in the fertile graveyard of life. &quot;
[align=center:3r95bev5]Thomas Ligotti - &quot;Mrs. Rinaldi's Angel &quot;[/align:3r95bev5]

class="gen" overwrites every other style in the <span>.
That's why the <b> tags won't have any effect there...
See what happends when you delete class="gen"

"Dr. Bantham";p="7725" wrote:I am not nearly as proficient as you are with Excel. If it is not too much trouble, it would be greatly appreciated if you would modify your spreadsheet to accommodate the third variable. It is a wonderful asset to this block! Again, thanks for sharing this with us!

I will create an excel file for 3 variables... <img>

Re: [MOD] Random quotes block - improved

PostPosted: Mon May 29, 2006 9:22 am
Author: Dr. Bantham
"evolver" wrote:class="gen" overwrites every other style in the <span>.
That's why the <b> tags won't have any effect there...
See what happends when you delete class="gen"
That had no effect. Note that I am successful in applying the bold attribute to the line containing the Author and Source. Curious. Do you have any ideas on why an extra space is being added before the closing quotation marks?[quote=""evolver""]I will create an excel file for 3 variables... <!-- s]Fantastic! I am elated that you are going the extra mile by accommodating the request. Many thanks!

Re: [MOD] Random quotes block - improved

PostPosted: Mon May 29, 2006 10:01 am
Author: evolver
You might use one of these, instead:
[code]<SPAN STYLE="font-weight]

Re: [MOD] Random quotes block - improved

PostPosted: Mon May 29, 2006 12:58 pm
Author: evolver
<img> Here's the Excel file for 3 lines/quote:

[size=99px]http://kile.sourceforge.net/images/download.png[/img]3-line quote management for Excel[/url][/size]

Re: [MOD] Random quotes block - improved

PostPosted: Mon May 29, 2006 3:55 pm
Author: Dr. Bantham
"evolver";p="7793" wrote:8) Here's the Excel file for 3 lines/quote:
Your skill is matched by your kindness. This is a great tool! Thanks[sup:1sl8ju0l]2[/sup:1sl8ju0l] (great MOD x great support).

Re: [MOD] Random quotes block - improved

PostPosted: Mon May 29, 2006 4:07 pm
Author: Dr. Bantham
"evolver";p="6826" wrote:Sorting can be done before the last page...
(sort first on column A, secondly on B or C)
When I attempt a sort on the referenced page (Rangschikking), it informs me that this sheet is protected. Attempting to remove protection results in a password prompt. Am I in the right place?

Re: [MOD] Random quotes block - improved

PostPosted: Mon May 29, 2006 4:23 pm
Author: evolver
<img> I have updated the file... (same link in previous post)
There's no more protection on 'Rangschikking' now,
so be carefull...
Only use that page for sorting,
if you delete anything there, it won't function anymore...
-> Always keep a backupcopy of the file, just in case...

For the 3line quotes excel file:
Sorting can be done before the last page...
Sort first on column A, secondly on B, C or D

Always first on column A to take empty rows to the buttom.
It detects empty rows and results in 0 for used rows and 1 for empty rows.
By this way, the empty rows (1) come after the used rows (0)

To do this, choose the columnheaders A,B,C and D (use shift-key to choose them all together),
Then in the upper pull-down menu, choose Data > Sorting
- Sorting on A
- Next on B or C or D (whatever you would like it to be sorted by)
- List without fieldnamerow

Re: [MOD] Random quotes block - improved

PostPosted: Wed May 31, 2006 7:25 pm
Author: doswald
hi guys, where can i download the whole and updated MOD of this?

regards
doswald

Re: [MOD] Random quotes block - improved

PostPosted: Fri Jun 02, 2006 12:32 am
Author: doswald
"doswald";p="8110" wrote:hi guys, where can i download the whole and updated MOD of this?

regards
doswald


bump! it's in this topic! do read first :wink: