You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 74 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Random quote block? Could you look at this code? [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
sagetyrtle
Sergeant
Sergeant


Joined: May 04, 2003
Posts: 111


PostPosted: Tue Jul 22, 2003 6:42 am Reply with quoteBack to top

Hey all,

Okay - so I found a thread on random quote block in the old PHPNuke forums. Someone wanted a random quote block, someone else said, try this:

Code:
<?
$content = "";
$title = "Quote by:";
mt_srand((double)microtime()*1000000);
$total = mysql_fetch_array(mysql_query("SELECT COUNT(qid) AS total FROM quotes"));
$tot = ($total[total]);
$p = ($tot+1);
while ($p>$tot){
$p = mt_rand(0,($total[total] - 1));
//mysql_select_db ("$dbname") or die ("Could not select database");
$query = ("SELECT * FROM quotes where qid = $p ");
$result = mysql_query ($query) or die ("Query failed1");
$r = mysql_num_rows($result);
//set_time_limit(0);
$row = mysql_fetch_object ($result);
}
$sl = strlen($row->quote);
if ($sl>2){
$content = "
$row->quote

$title
$row->author";
$content .= "<hr><center>There are $tot
quotes in the database.</center>";
$content .= "<center>and this is no: $p</center>";
} else {
// this is what we say when the quotes database is empty
$content = 'It is NOT what you know,
but to know where to find it';
}
mysql_free_result ($result);

?>


Now, I know you'd have to actually create a quotes database, and I'm not entirely sure how to do that, so I could use help with it, and also - would I just save the above as quotes.php, and stick it in html/blocks ?

Thanks much for any help you can give.
-Sage
Find all posts by sagetyrtleView user's profileSend private message
esteyguy
Nuke Soldier
Nuke Soldier


Joined: Jun 09, 2003
Posts: 21


PostPosted: Sat Aug 09, 2003 6:34 am Reply with quoteBack to top

Can anyone please help us with this?

_________________
Textilicious! | DelRi Web Hosting
Find all posts by esteyguyView user's profileSend private message
sagetyrtle
Sergeant
Sergeant


Joined: May 04, 2003
Posts: 111


PostPosted: Sat Aug 09, 2003 6:36 am Reply with quoteBack to top

Hi Esteyguy -

I figured out a work-around, which is sort of tedious but it serves my purpose - I used the Cafepress block, took out all the links, then just saved my taglines (which I wanted to come up randomly whenever the page was reloaded) as transparent gif files. You can't actually tell that it's not real text. But if you wanted hundreds of quotes, that solution wouldn't work for you.
Find all posts by sagetyrtleView user's profileSend private message
chris-au
Elite Nuker
Elite Nuker


Joined: Jan 31, 2003
Posts: 717


PostPosted: Sun Aug 10, 2003 11:16 pm Reply with quoteBack to top

That is a block thst I hacked/wrote and put in a thread to help somebody.

I do have a database with over 11000 quotes and on each page transition it will diplay another quote.

Here is a small sample of the sql file:

# phpMyAdmin MySQL-Dump
# version
#
# http://phpmyadmin.sourceforge.net/ (download page)
#
# Host: localhost
# Generation Time: Mar 30, 2002 at 08:58 AM
# Server version: 3.23.33
# PHP Version: 4.0.6
# Database :
# --------------------------------------------------------

#
# Table structure for table `nuke_quotes`
#

DROP TABLE IF EXISTS nuke_quotes;
CREATE TABLE nuke_quotes (
qid int(10) unsigned NOT NULL auto_increment,
quote text,
author varchar(150) NOT NULL default '',
PRIMARY KEY (qid)
) TYPE=MyISAM;

#
# Dumping data for table `nuke_quotes`
#

INSERT INTO nuke_quotes VALUES (1, '"Be yourself" is about the worst advice you can give to people. ', 'Tom Masson');
INSERT INTO nuke_quotes VALUES (2, '"Hello," he lied. ', 'Don Carpenter, quoting a Hollywood agent');
INSERT INTO nuke_quotes VALUES (3, '"Home, Sweet Home" must surely have been written by a bachelor. ', 'Samuel Butler');

_________________
Chris
Find all posts by chris-auView user's profileSend private messageVisit poster's website
chris-au
Elite Nuker
Elite Nuker


Joined: Jan 31, 2003
Posts: 717


PostPosted: Sun Aug 10, 2003 11:18 pm Reply with quoteBack to top

That is a block thst I hacked/wrote and put in a thread to help somebody.

I do have a database with over 11000 quotes and on each page transition it will diplay another quote.
Code:

Here is a small sample of the sql file:

# phpMyAdmin MySQL-Dump
# version
#
# http://phpmyadmin.sourceforge.net/ (download page)
#
# Host: localhost
# Generation Time: Mar 30, 2002 at 08:58 AM
# Server version: 3.23.33
# PHP Version: 4.0.6
# Database :
# --------------------------------------------------------

#
# Table structure for table `nuke_quotes`
#

DROP TABLE IF EXISTS nuke_quotes;
CREATE TABLE nuke_quotes (
  qid int(10) unsigned NOT NULL auto_increment,
  quote text,
  author varchar(150) NOT NULL default '',
  PRIMARY KEY (qid)
) TYPE=MyISAM;

#
# Dumping data for table `nuke_quotes`
#

INSERT INTO nuke_quotes VALUES (1, '"Be yourself" is about the worst advice you can give to people. ', 'Tom Masson');
INSERT INTO nuke_quotes VALUES (2, '"Hello," he lied. ', 'Don Carpenter, quoting a Hollywood agent');
INSERT INTO nuke_quotes VALUES (3, '"Home, Sweet Home" must surely have been written by a bachelor. ', 'Samuel Butler');

_________________
Chris
Find all posts by chris-auView user's profileSend private messageVisit poster's website
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.332 Seconds - 295 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::