Quick quick, i have to take bath n go to the temple. The title says everything, i need not elaborate on what i am gonna write. Ok, why am i wasting time writing this.
What it does?
What it does?
Displays random quotes on your blogger page.
Got the idea from?
This and this. I dowanna debate on who came up with the idea first. Its obvious that you guys also got the idea from somewhere else.
Advantage over the above ideas
Any number of quotes and no hard coding of the quotes. You can change them on the fly with some effort.
Disadvantage
Some extra network bandwidth is utilised each time it is displayed. Not too much. Depands, if 100Kb is too costly for you.
Things to do first
* Go to your blogger account settings page and enable full feed. By default, blogger gives only the first para or 256 chars. Change this settings to full feed.
* Create the quotes file with quotes in it. Quotes should be delimited by "%".e.g file contents below.
* Go to your blogger account settings page and enable full feed. By default, blogger gives only the first para or 256 chars. Change this settings to full feed.
* Create the quotes file with quotes in it. Quotes should be delimited by "%".e.g file contents below.
mary had a little lamb and it ran away
%
Where did the lamb go?
%
Who are you to ask? It went its way!!!
%
This should be enough for you to know the quotes file format.
Note that, "%" should not appear before the first quote and after the last quote. This can be handled in js but i am bit lazy now to do it and got lot other work too.
* Create a new post, go to the html view and paste the contents of the quotes file there. Publish the post. If you dowant the post to appear on front page, change the post date back to your school time.
* Go to the quotes page and copy the post id form the comments link. e.g :
http://www.blogger.com/comment.g?blogID=18356831&postID=358823621417987856
Red coloured number is blog id and blue coloured is the post id. Make a note of it.
* Add a page element to your template and add this js code where you want to quote
<script language="javascript">
function displayQuote(root) {
var content = root.entry.content.$t ;
var quotesArray = content.split('%');
var index = Math.floor(Math.random() * quotesArray.length);
var quote = quotesArray[index];
var d = document.getElementById ("quotesDiv").innerHTML = quote;
}
</script>
<div id="quotesDiv"></div>
<script language="javascript" src=" http://www2.blogger.com/feeds/DDDDD/posts/full/OOOOOOOO?alt=json-in-script&callback=displayQuote"
></script>
Wait, dont close the widget editor. Replace DDDDD with your blog id and OOOOOO with your quotes post id.
* To add flavour, add css for the quotesDiv if you want.
* Next time when you want to change the quotes, just edit the post and change the contents and republish it.
You can see it working. I followed the same steps. Still if there are any typos, let me know.
Cool!! I like that.
--
regards/Yogesh
* Create a new post, go to the html view and paste the contents of the quotes file there. Publish the post. If you dowant the post to appear on front page, change the post date back to your school time.
* Go to the quotes page and copy the post id form the comments link. e.g :
http://www.blogger.com/comment.g?blogID=18356831&postID=358823621417987856
Red coloured number is blog id and blue coloured is the post id. Make a note of it.
* Add a page element to your template and add this js code where you want to quote
<script language="javascript">
function displayQuote(root) {
var content = root.entry.content.$t ;
var quotesArray = content.split('%');
var index = Math.floor(Math.random() * quotesArray.length);
var quote = quotesArray[index];
var d = document.getElementById ("quotesDiv").innerHTML = quote;
}
</script>
<div id="quotesDiv"></div>
<script language="javascript" src=" http://www2.blogger.com/feeds/DDDDD/posts/full/OOOOOOOO?alt=json-in-script&callback=displayQuote"
></script>
Wait, dont close the widget editor. Replace DDDDD with your blog id and OOOOOO with your quotes post id.
* To add flavour, add css for the quotesDiv if you want.
* Next time when you want to change the quotes, just edit the post and change the contents and republish it.
You can see it working. I followed the same steps. Still if there are any typos, let me know.
Cool!! I like that.
--
regards/Yogesh