[RC1] Random Quotes 1.7.2

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
User avatar
freddie
Registered User
Posts: 404
Joined: Sun Mar 31, 2002 1:40 pm
Location: Estes Park, USA
Contact:

Post by freddie » Mon Feb 05, 2007 8:52 pm

does it works correct on 2.0.22 ?

User avatar
dfritter4
Registered User
Posts: 479
Joined: Wed Jul 20, 2005 6:39 pm
Location: Ohio
Contact:

Post by dfritter4 » Tue Feb 06, 2007 1:33 am

it does on my board.

User avatar
dfritter4
Registered User
Posts: 479
Joined: Wed Jul 20, 2005 6:39 pm
Location: Ohio
Contact:

Post by dfritter4 » Tue Feb 06, 2007 1:36 am

spamyboy wrote: I'm getting same error


i wonder if its because you have an older version of the php engine which might not accept some of the same function parameters as the newest php engine.

if so, theres nothing i can do unless i decide to re-write this mod.

Addicted2Life
Registered User
Posts: 22
Joined: Wed Dec 06, 2006 12:40 am
Contact:

Post by Addicted2Life » Thu Feb 15, 2007 8:06 pm

I am encountering this error:

phpBB : Critical Error

Could not query quotes information in admin_random_quotes

DEBUG MODE

SQL Error : 1146 Table 'svufansn_phpb4.QUOTES_TABLE' doesn't exist

SELECT * FROM QUOTES_TABLE

Line : 52
File : admin_random_quotes.php

In the install package i didnt see any thing to edit with the sql.

User avatar
dfritter4
Registered User
Posts: 479
Joined: Wed Jul 20, 2005 6:39 pm
Location: Ohio
Contact:

Post by dfritter4 » Fri Feb 16, 2007 2:58 am

you apparently didn't run the SQL code at the beginning of the MOD installation guide

Code: Select all

#
#-----[ SQL ]------------------------------------------
#
CREATE TABLE `phpbb_quotes` (
`quotes_name` VARCHAR( 255 ) NOT NULL ,
`quotes_value` LONGTEXT NOT NULL
) TYPE = MYISAM ; 
 
INSERT INTO `phpbb_quotes` ( `quotes_name` , `quotes_value` )
VALUES (
'rndm_quotes', 'Enter your quotes here!'
);

INSERT INTO `phpbb_quotes` ( `quotes_name` , `quotes_value` )
VALUES (
'quotes_color', 'black'
);

INSERT INTO `phpbb_quotes` ( `quotes_name` , `quotes_value` )
VALUES (
'quotes_italic', '0'
);

INSERT INTO `phpbb_quotes` ( `quotes_name` , `quotes_value` )
VALUES (
'quotes_bold', '0'
);

INSERT INTO `phpbb_quotes` ( `quotes_name` , `quotes_value` )
VALUES (
'quotes_underline', '0'
);

INSERT INTO `phpbb_quotes` ( `quotes_value` , `quotes_name` )
VALUES (
'0', 'quotes_onoff'
);

INSERT INTO `phpbb_quotes` ( `quotes_name` , `quotes_value` )
VALUES (
'quotes_font', 'monospace'
);

INSERT INTO `phpbb_quotes` ( `quotes_name` , `quotes_value` )
VALUES (
'quotes_font_size', '12'
);

XianRev
Registered User
Posts: 9
Joined: Thu Nov 11, 2004 4:51 am
Contact:

Post by XianRev » Fri Mar 02, 2007 9:39 am

Code: Select all

Warning: explode(): Empty delimiter. in /home/content/a/g/n/agnadmin/html/site/includes/functions_quotes.php on line 31

Warning: shuffle() expects parameter 1 to be array, boolean given in /home/content/a/g/n/agnadmin/html/site/includes/functions_quotes.php on line 34

Warning: Cannot modify header information - headers already sent by (output started at /home/content/a/g/n/agnadmin/html/site/includes/functions_quotes.php:31) in /home/content/a/g/n/agnadmin/html/site/includes/page_header.php on line 501

Warning: Cannot modify header information - headers already sent by (output started at /home/content/a/g/n/agnadmin/html/site/includes/functions_quotes.php:31) in /home/content/a/g/n/agnadmin/html/site/includes/page_header.php on line 503

Warning: Cannot modify header information - headers already sent by (output started at /home/content/a/g/n/agnadmin/html/site/includes/functions_quotes.php:31) in /home/content/a/g/n/agnadmin/html/site/includes/page_header.php on line 504
Looks like I'm getting the same error as colin_bb and spamyboy. This was done on a fresh install of phpBB 2.0.22, no other mods installed and this mod was installed manually with all the required files being modified/uploaded appropriately. My forum is on a server running PHP 4.3.11 (and for reference, I'm also using MySQL 5.0.18, heh).
I know PHP has seen some newer versions released. You last updated this mod last October, and at the time the newest version of PHP was 4.4.4.. But as far as I can tell, anyone running PHP 4.3.0 and up (according to a script I found online that finds the minimum version required for any given PHP script) should be able to use the code in your mod without any problems.. is this a bug in the mod or am I overlooking a simple fix that I need to apply?
Praise God! This I shall do, now and forever. And without shame, my heart is for the Lord.

XianRev
Registered User
Posts: 9
Joined: Thu Nov 11, 2004 4:51 am
Contact:

Post by XianRev » Fri Mar 02, 2007 11:08 am

Update - Well, I was able to make some changes to the code so that it shows the quotes properly.. Had to change the layout of the explode() and shuffle() so the quotes were retrieved properly. The only problem now, it seems, is that I'm using the wrong array code for explode() - It's displaying all of the quotes together, instead of one random one at a time.
Praise God! This I shall do, now and forever. And without shame, my heart is for the Lord.

User avatar
dfritter4
Registered User
Posts: 479
Joined: Wed Jul 20, 2005 6:39 pm
Location: Ohio
Contact:

Post by dfritter4 » Fri Mar 02, 2007 6:28 pm

ok heres the problem that i emailed some other people about:

the mod package that i have uploaded is an unfinished version. i started to add a feature and never finished. so basically half the code is missing.

what you need to do in order for it to work properly is this:

in page_header.php

where it has the

Code: Select all


explode($board_quotes;'separator'] , $board_quotes['something'])

change it to:

Code: Select all


explode(" | ", $board_quotes['quotes'] )



and then when ur entering your quotes, separate them by a " | " (shift + key above the enter key)

i believe this fixes the problem

XianRev
Registered User
Posts: 9
Joined: Thu Nov 11, 2004 4:51 am
Contact:

Post by XianRev » Fri Mar 02, 2007 11:48 pm

Using the original functions_quotes code (all my changes gone) with the change you mentioned gives nothing but the following:

Parse error: parse error, unexpected T_STRING in /home/content/a/g/n/agnadmin/html/site/includes/functions_quotes.php on line 34

*Edit - Figured I could post what code I'm using. It "works" to some extent.. The extent being that where it should display the quote it simply says Array, and it will, seemingly at random, display those errors previously mentioned about the header information not being sent. What it *does* do, however, is show one of the random quotes when those errors also appear.

Code: Select all

//take the long original string and split it into individual quotes in the $rndm_quotes_array 	
$rndm_quotes_array = explode("|", $board_quotes['quotes']);
echo $rndm_quotes_array[rand(0,99)];


//shuffle the values of the rndm_quotes_array to get a randomly generated effect
// shuffle($thequotes);

//pick a random quote with the a default index array search since the indexes
// of rndm_quote_array will be different every time
$rndm_quotes = $rndm_quotes_array;
Praise God! This I shall do, now and forever. And without shame, my heart is for the Lord.

User avatar
dfritter4
Registered User
Posts: 479
Joined: Wed Jul 20, 2005 6:39 pm
Location: Ohio
Contact:

Post by dfritter4 » Sun Mar 04, 2007 3:02 am

i got it to work on my test board using a few tweaks to the MOD i currently have uploaded.

it works fine for me.

use this as your functions_quotes.php

Code: Select all

<?php
/***************************************************************************
 *                             functions_quotes.php
 *                            -------------------
 *   begin                : Thursday July 12 2006
 *   copyright            : (C) 2006 dfritter4
 *   email                : dfritter4@yahoo.com
 *   website           : http://www.motrclan.com
 *
 *   $Id: quotes.php,v 0.0.1 2006/07/12 12:32:09 dfritter4 Exp $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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.
 *
 ***************************************************************************/
 
 //just going to define one little function so that we dont have to write all the code out in the page_header.php
 
function exec_rndm_quotes() {
	global $rndm_quotes, $quotes_bold, $quotes_italic, $quotes_underline, $rndm_quotes_array, $board_quotes; 
	

//take the long original string and split it into individual quotes in the $rndm_quotes_array 	
$rndm_quotes_array = explode(" | ", $board_quotes['rndm_quotes']);

//shuffle the values of the rndm_quotes_array to get a randomly generated effect
shuffle($rndm_quotes_array);

//pick a random quote with the a default index array search since the indexes
// of rndm_quote_array will be different every time
$rndm_quotes = $rndm_quotes_array[0];

//get the different formatts and tell each one what theyre supposed to do 
// like bold, italic, and underline
// BTW MOD TEAM THAT WILL BE READING THIS: if there's an easier way, feel free
// to let me know
	if( $board_quotes['quotes_bold'] == TRUE )
	{
		$quotes_bold = 'b';
	}
	else
	{
		$quotes_bold = 'nothing';
	}
	if( $board_quotes['quotes_italic'] == TRUE)
	{
		$quotes_italic = 'i';
	}
	else
	{
		$quotes_italic = 'nothing';
	}
	if( $board_quotes['quotes_underline'] == TRUE)
	{
		$quotes_underline = 'u';
	}
	else
	{	
		$quotes_underline = 'nothing';
	}
	if( $board_quotes['quotes_onoff'] == FALSE)
	{
		$rndm_quotes = "";
	}
	else
	{
		//do nothing because we want the quotes turned on	
	}
	
}

//this is a function for selecting the font. it took me forever to figure out how to do this perfectly btw ;)

function quotes_font_select($default, $select_name = 'quotes_font')
{
	global $quotes_font, $lang;

	if ( !isset($default) )
	{
		$default == $font_name;
	}
	$quotes_font = '<select name="' . $select_name . '">';

	while( list($font_name, $font_name_appearance) = @each($lang['quotes_font']) )
	{
		$selected = ( $font_name == $default ) ? ' selected="selected"' : '';
		$quotes_font .= '<option value="' . $font_name . '"' . $selected . '>' . $font_name_appearance . '</option>';
	}
	$quotes_font .= '</select>';

	return $quotes_font;
	
}

//this is a function for selecting the font size. same as font style function

function quotes_font_size_select($default, $select_size = 'quotes_font_size')
{
	global $quotes_font_size, $lang;
	
	if (!isset($default) )
	{
		$default == $font_size;
	}
	$quotes_font_size = '<select name="' . $select_size . '">';
	
	while( list($font_size, $font_size_appearance) = @each($lang['quotes_font_size']) )
	{
		$selected = ( $font_size == $default ) ? ' selected="selected"' : '';
		$quotes_font_size .= '<option value="' . $font_size . '"' . $selected . '>' . $font_size_appearance . '</option>';
	}
	$quotes_font_size .= '</select>';
	
	return $quotes_font_size;
	
}
?>
 

azw
Registered User
Posts: 246
Joined: Mon Feb 24, 2003 12:41 am
Contact:

Re: [RC1] Random Quotes 1.7.2

Post by azw » Wed Mar 28, 2007 6:56 am

Hello, Is it possible to just display the latest quote?

Maybe it would be helpful to tell you what I have in mind.

I'd like to be able to show a "word of the week" along with its definition and an example. It'd also be great if I could show all of the words, in case someone wanted to learn the previous words.

Or maybe there's another mod that would do this better?
Multilingual & bilingual websites for businesses and nonprofits

User avatar
dfritter4
Registered User
Posts: 479
Joined: Wed Jul 20, 2005 6:39 pm
Location: Ohio
Contact:

Re: [RC1] Random Quotes 1.7.2

Post by dfritter4 » Fri Mar 30, 2007 6:39 pm

what you could do (without me having to do a lot of modifications to the current mod)

is just enter one quote and change it every week. since you're only going to be using the most updated quote per week, theres no real reason to keep the previous ones.

azw
Registered User
Posts: 246
Joined: Mon Feb 24, 2003 12:41 am
Contact:

Re: [RC1] Random Quotes 1.7.2

Post by azw » Fri Mar 30, 2007 6:50 pm

Thanks for the reply, Dfritter4. Yeah, that would have been a good solution, except that I'd rather have the old messages as available for reference (or recycling!). Our purpose is to encourage visitors to learn a few words in another language, which is why it'd be good to have the old words remain available.

What I've decided to do is to draw the items from a forum. The most recent gets shown on the index. And then it and all the previous posts are still available in the forum, too. So far it's working pretty well. I've got a little routine that will crop it at the end of the nth word, so I can keep the amount of space used on the index to a reasonable size.

I don't think there is another mod that does this. I suppose we each have very different needs.
Multilingual & bilingual websites for businesses and nonprofits

zahira
Registered User
Posts: 35
Joined: Fri Mar 30, 2007 3:16 pm

Re: [RC1] Random Quotes 1.7.2

Post by zahira » Tue Apr 03, 2007 1:36 pm

thanks a lot for this mod, very nice , god bles you dear

mkonji
Registered User
Posts: 2
Joined: Mon Mar 05, 2007 12:43 pm

Re: [RC1] Random Quotes 1.7.2

Post by mkonji » Tue Apr 03, 2007 2:05 pm

Work on me!!!


thanks sir

Post Reply

Return to “[2.0.x] MODs in Development”