.Random Quotes

I guess there are more than a thousand “random quotes” plugins/mods/hacks out there, but I can guarantee this one is the easier and less efficient one !

I’m certainly not a big fun of quotes, but bloggers seem to love them, so, follow these easy-as-a-pie steps and start quoting.

(by the way, I used to say my own truths as if they were said by, let’s say, Oscar Wilde, and believe me, It works)

Steps to follow:
1) Build up a txt file, and write (or paste) on it all the quotes you have. One in every line, without blank lines please.

2) Save it as “whatever_name_here.txt”

3) Upload it to any folder (preferabily the root folder)

4) add this code in the template file you want the quotes to appear. In my case, I pasted this code in sidebar.php file.

<?php
	///relative path 
	$lines = file('/subfolder/whatever_name_here.txt');

	///This would be the full path way (chose one of them, of course)
	$lines = file('http://yoursite.com/subfolder/whatever_name_here.txt');

	$quote = rand(0, count($lines));
	echo '<div>';
 
	echo 'Today\'s quote:<br>';
 
	echo $lines[$quote];
 
	echo '</div>';
 
?>

That’s all, easy right?

 

._-_.

Leave a Reply

You must be logged in to post a comment.