Latest posts

Friday, 6 March 2009

Random Posts widget for Blogger blog

If you’re interested in creating a random links list on your own Blogger/Blogspot blog, read on for the complete instructions.

How To Show Random Links On Your Blogspot Blog
Go to the Layout Tab and click Add Page Element.
Find Links List and click Add To Blog.
Type in a title and click Save Changes.
Go to the top of the Layout page and click Edit HTML
Click Download Full Template, so that if you mess this up, you’ll have a backup of your template.
Put a check in the checkbox that reads Expand Widget Templates.
Search for the line in the template that contains the title you input. It should look something like this:

<b:widget id='LinkList1' locked='false'
title='MyListTitle' type='LinkList'>

This is the start of the widget you created. Don’t touch this line, but delete all the lines below it until you reach </b:widget>. This is the end of the link list widget. Now you have an empty links widget. Your code should look something like this:

<b:widget id='LinkList1' locked='false' title='MyListTitle' type='LinkList'>



What you’ve done is gutted the Links widget, and now you’re going to fill the space with the new random blogroll guts. Take the following code and insert it into the section above that reads “NEW CODE WILL GO HERE”. Please don’t make me tell you that “<--NEW CODE WILL GO HERE-->” should NOT be in your code. You knew that already.

<b:includable id='main'>
<b:if cond='data:title'><h2><data:title/></h2></b:if>
<div class='widget-content'>
<script type='text/javascript'>
var maxlinks = 10;
var linksarray = new Array();
var linksarray2 = new Array();
<b:loop values='data:links' var='link'>
linksarray.push("<a expr:href=''><></a>");
if (maxlinks>linksarray.length){maxlinks=linksarray.length;}
for (var i=1;i<=maxlinks;i++)
linknum = Math.floor(Math.random()*linksarray.length);
for (x in linksarray2.sort())
document.write('<li>'+ linksarray2[x] + '</li>');
<b:include name='quickedit'/>

Well, Dr. Frankenblogger, you’re almost there. The widget defaults to 10 random links. If you want to change that, change the number on this line: var maxlinks = 10; to the number of links that you’d prefer.
Click Save Template.
Click on the Layout Tab.
Click Edit on the Links Widget and add some links to your blogroll.
As always, if you run into problems implementing this, let me know.

All the credits For this wonderful method Goes to Mr. Jon Dyer.

0 reponses:

Latest Comments


Link Exchange

1. watch Arabic Movies
2. Xenu RapidShare Downloads
3. Warez Inc.
4. Disaster RX

To exchange links with us, contact us here

Blog Archive

Users Online

My BlogCatalog BlogRank

Subscribe To Newsletter

Get our Updates in Your Inbox. We will Send You only One Email Every Day.

Enter your email address:

Delivered by World4masti Mail


 Subscribe in a reader

Visit Sources

Site Stats

  © Blogger templates The Professional Template by 2008

Back to TOP