18 How to modify the Popular Posts widget to suit your blog's style
August 14, 2007 /

In this previous post, I explained how to use the Affiliatebrand Popular Posts widget. As you can probably tell, I've modified this widget in my own blog so that it matches the overall look of my template. My method is far from being perfect, but as my original post has attracted many readers, I've decided to share this method with you in order for you to customize your own widgets.

The widget code provided by AffiliateBrand links to a javascript file which is unique to your blog, and contains all the code nescessary for constructing the widget style. The default widget is made up of images and "iframes" in order to give it a "Web 2.0" style.

Unfortunately the appearance of this widget is not something that suits the style of all blog templates!

So, in order to be able to style the look of the widget, we need to strip the javascript of all image-related code, and feature only the useful elements instead.

But before you do this, be sure to make a backup of the original widget code as you will need to use this later!

To create a modified "Popular posts" widget, you will need to edit the javascript file which your original widget code is linked to. The best way to do this is to highlight the URL to the javascript file, paste this into your browser, and save the javascript file to your computer so you can edit it with Notepad. Here is an example of what the original widget code will look like; the URL of the javascript file is highlighted in red:

<div style="display:none"><script src="http://AffiliateBrand.com/img/559140890-265v2.js" type="text/javascript"></script></div>
However, you must be sure to use the file url of your own widget as this is unique to your blog!

Now, once you have the Javascript file and have opened it in Notepad (or a different simple text editor), you will need to locate and copy two of the three "iframes" within the code. The easiest way to do this is to press CTRL+F and search for "iframe". The iframe lines should look something like this:

<iframe src="http://AffiliateBrand.com/BlogWindow/Title2.aspx?w=195&style=http://kunoichi.info/bloggerbuster_templates/bb_popular_posts.css&t='+escape('Most Popular Posts') + '" width="195px" height=35px"275px" frameborder="0" marginheight="0" marginwidth="0" scrolling="no"></iframe>

<iframe src="http://AffiliateBrand.com/BlogWindow/WidgetBlank.aspx?r=559140890-265&style=http://kunoichi.info/bloggerbuster_templates/bb_popular_posts.css" width="200px" height="275px" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto"></iframe>

<iframe src="http://AffiliateBrand.com/BlogWindow/PoweredByV2.aspx?r=559140890-265&w=190" height="40" width="195" scrolling="no" frameborder="0" style="margin-top:5px" ></iframe>

The first iframe in the script (highlighted in blue) is unnecessary since it only refers to the title of your widget, which you can easily configure using the title of your newly configured widget later on. The second iframe is the most important, since this is where your most popular posts are highlighted. The third iframe provides authorship details of the widget and a link back to AffiliateBrand. You really should include this in your modified widget as I will explain later.

Once you have copied the necessary iframe lines to Notepad, you can then begin to create your modified "Popular posts" widget!

To do this, create a new HTML/Javascript element in your blog sidebar, and name it "Popular Posts" or something similar. Next you need to create boundaries for the iframes in order to style the way they are displayed. My own Popular Posts widget is styled using DIV tags like this:

<div style="width: 230px; background:#ffffff; padding: 9px;" class="widget-mid">
insert iframe 2 here...
<div style="clear: both; height: 1px; font-size: 0.1px; border: none; margin: -1px 0 0 0; padding: 0; background: transparent;" class="clear"></div>
<div style="width: 200px; background: #ffffff; padding: 0;" class="widget-mid">
insert iframe 3 here...
<div style="clear: both; height: 1px; font-size: 0.1px; border: none; margin: -1px 0 0 0; padding: 0; background: transparent;" class="clear"></div>
</div>
<div style="width: 200px; height:7px; background: #ffffff;" class="widget-bottom"></div>
<div style="clear: both; height: 1px; font-size: 0.1px; border: none; margin: -1px 0 0 0; padding: 0; background: transparent;" class="clear"></div>
</div>
You can use this as a template for your own widget if you like, making sure that you include the iframe code where specified. The background color can be altered to suit your own blog colors. If you have a good grasp of HTML code, you can easily enclose the iframes in a different style, or even in a table.

Once you've configured your customised widget, save the element and take a look at your blog's sidebar: the "Popular posts" widget you created should now be visible in the template!

However, there is one more thing you should do in order to ensure your widget works correctly. Remember how I said earlier that you'd need the original widget code later on? You need to use this now. Create another HTML/Javascript element in your sidebar, but don't give this one a name. Paste the original code into the element, but wrap it in styled <div> tags, like this:

<div style="display:none"><script src="http://AffiliateBrand.com/img/559140890-265v2.js" type="text/javascript"></script></div>
The part "display:none" ensures that the widget is not actually displayed in your blog. But you still need the extra widget present in order for your new customized widget to work properly! For some reason, the modified version of the widget doesn't update AffiliateBrand with the data of your most popular posts. After looking through the original javascript, I am yet unable to tell which line is used to gather this data, so by including the "non-viewable" second widget, we can still ensure that the customized widget is updated.

I must warn you before that AffiliateBrand does state that you should not modify the contents of the javascript file, and should implement the widget code in your blog as it is provided to you. The most likely reason for this is to stop people from deleting the link back to AffiliateBrand. Personally, I would consider deletion of this iframe unfair since AffiliateBrand do provide the widget free of charge, without the need to sign up as a member! This is in fact the reason that I think you should retain the third iframe code for use in your customized widget. If you do decide to delete the link back from your own widget, do so at your own risk! This could result in the javascript relating to your blog's popular post widget being deleted from the server, in which case your widget will cease to work!

In using the method I have described here (retaining the link back and including a second, non-viewable customized widget), you can be more sure that the necessary components are still in place.

Technorati Tags: | | |

Author: Amanda Kennedy

Amanda is a professional blogger and web designer living in Sheffield, United Kingdom.

In addition to curating Blogger Buster, you can find Amanda on Twitter, Facebook or add her to your circle on Google+.

Like to share?

You may also like to subscribe to Blogger Buster's RSS feed or receive free email updates of our latest posts.

18 Comments:

  1. Amanda --

    I love what you've done with my Blog Window widget -- you've made it look exceptional on your site.

    Also, thank you for your feedback -- I'm listening very carefully :)

    I do have a few thoughts and would love your feedback:

    1. If people eliminate the JavaScript and place their own code, I'm unable to make any improvements to the widget since my improvement won't be picked up by those who have eliminated the JavaScript. So, you have make changes manually each time I make something live.

    2. If you ever want to resize the widget because you've decided to change how many popular posts you want to appear or if you simply want to change dimension of your site, if you eliminate the JavaScript, you won't have an ability to simply go into your account on http://AffiliateBrand.com and modify it.

    3. You may have seen that I offer two options for the widget look: one with thick borders and one with thin borders. If I simply offer a 3rd options to have no borders, this will give you everything you are looking for since you can already modify the look and feel of your title and body with the stylesheet. I can have that ready by the end of the week.

    Let me know your thoughts.

    In the meantime, thanks for enjoying the Blog Window widget.

    Gene Kavner
    http://AffiliateBrand.com
    http://AnalyticsWizard.com

    ReplyDelete
  2. Hello Gene,

    Thank you for your comments and especially for your feedback about the customizations I've explained here.

    Personally I would love to see a version of your Blog Window widget without borders! This would make it so much easier to change the overall look of the widget to fit any blog template, without the downfall of losing the ability to customize the widget in my AffiliateBrand dashboard. I'm sure many of the readers here would agree.

    If you do decide to create a new style without borders, I will probably be amongst the first few to install it, and will certainly post about this here at Blogger Buster to inform my readers of the new style.

    Thank you and best wishes,

    Amanda

    ReplyDelete
  3. Amanda --

    Thank you for your email and for your comments.

    Per our discussion, I just added the new "No Borders" template. Take a look at:

    http://affiliatebrand.com/Account/ProfileSiteWindow.aspx

    I believe this template, in conjunction with the ability to create your own stylesheet, will allow you and your readers the full ability to customize the look of the Blog Window widget.

    Would love your thoughts.

    Have a terrific day,

    Gene
    http://AffiliateBrand.com
    http://AnalyticsWizard.com

    ReplyDelete
  4. Struggled through this and managed to get it on my site and changed the fonts. The colours seem to have a mind of their own! I took the colour codes from the template (#cc6600 is the crucial one) but it seems to pay no attention to this. Any suggestions?

    ReplyDelete
  5. It would be much easier for you to customize the widget by using the new "No-borders" widget style (in the Affiliatebrand settings for the widget) and customizing this using an external stylesheet.

    I wrote about this here if you would like to take a look:

    http://www.bloggerbuster.com/2007/08/popular-posts-widget-updated.html

    I find this method much simpler and have now implemented this new method in my blog instead. I hope this helps you customize your widget!

    ReplyDelete
  6. Generic Viagra


    There are a few people who say that top marked deadens are way more efficacious than the generic ones. Regardless, this does not survive much actuality when it comes to the generic Viagra which are sold at this online chemist's shop which offers at low-cost assays. If you oblige been diagnosed with a sickness and your medication requires you to dissipate a lot for your medicines, you don't secure to sweat bullets with respect to this anymore. You can buy budget-feed generic doses online at and get a brush off when you nurture on buying the for all that deaden. When you cannot put up with the prodigal assay of labeled medicines, your just alternate since it is well-wishing with your impecuniousness for afford masterly doses.

    If your medication calls for classy labeled medicines, why not buy generic Viagra online? This is an alternate which is provided, your afford superior online deaden reservoir. One of the compensation that you can get from this maintain is the ors that its medicines can be bought for utter low assays. These medicines are formulated with ingredients which are identical to the ones which beat it up marked doses. Regardless, the tolls of the two are in every respect altered. Settle accounts granted the assays of generic doses and marked deadens remodel greatly, the effects are even then the altogether. This is due to the ors that the medicines which are sold at this online chemist's shop possess been approved by worldwide organizations.

    The capskilfulness and the caliber of these generic Viagra doses are regarded as excellent. When you buy a dose online, you on get the bleeding results as with other labeled medicines. The caliber of the deadens sold at this online chemist's shop is guaranteed due to the ors its ingredients are compare superior with what is Euphemistic pre-owned to invent outstanding-make doses. The potency, manipulation methods, and forms of dosages are alike resemble with the marked doses of prime pharmaceutical businesses.

    You can buy trashy doses online when you are diagnosed with a bug. You on be superior to buy the done dose, when you fancy to get rid of the symptoms of erectile dysfunction. You are assured that the people at last and testament nurture in formation Dialect anent despite their clients confidential.

    Author
    Davidmaria
    URL:
    http://www.onlinepharmacy.vg/catalog/-c-32_117.html

    ReplyDelete
  7. If you, like so many others, aredg in the market for Generic Viagra, buying Online Pharmacy no Prescription is your best bet for finding fantastic deals on high quality generic medications. We understand that so many people are struggling to make ends meet in these difficult times, and health insurance does not always include prescription coverage. More Info at: http://www.safemeds.com/

    ReplyDelete
  8. They each take effect in up to 30 minutes, give or take a few minutes. The best part about Cialis is that it offers the couple more
    lexibility.

    ReplyDelete
  9. I was looking for that information, thanks for your helpful blog

    ReplyDelete
  10. Nice blog, its great article informative post, thanks for sharing it. Thanks for the information!

    santana

    ReplyDelete
  11. This is the perfect blog for anyone who wants to know about this topic.  You know so much its almost hard to argue with you (not that I really would want...HaHa).  You definitely put a new spin on a subject thats been written about for years.  Great stuff, just great!

    ReplyDelete
  12. Good blog, after a great informative article, thanks for sharing. Thanks for this info!

    ReplyDelete
  13. I am thoroughly convinced in this said post. I am currently searching for ways in which I could enhance my knowledge in this said topic you have posted here. It does help me a lot knowing that you have shared this information here freely. I love the way the people here interact and shared their opinions too. I would love to track your future posts pertaining to the said topic we are able to read.

    ReplyDelete
  14. Thanks for taking the time to discuss this, I feel strongly about information and love learning more on this. If possible, as you gain expertise, It is extremely helpful for me. would you mind updating your blog with more information

    ReplyDelete
  15. Nice blog, its great article informative post, thanks for sharing it. Thanks for the information!

    ReplyDelete
  16. Very interesting thanks. I believe there's even more that could be on there! keep it up

    ReplyDelete
  17. Thanks to share with us the information. I wish you good luck!

    ReplyDelete

Great! You've decided to leave a comment! Please bear in mind that comments are often moderated and that rel="nofollow" is in use and spammy comments will be deleted. Let's have a meaningful conversation instead. Thanks for stopping by!

Browse through the Archives

All existing posts are still available to view while I'm working on the site, albeit seen in a much simpler interface. Feel free to browse through the archives to find tutorials, templates and articles to help you build a better blog:

Blog Archive

© Blogger Buster 2010 Home | About | Contact | Hire Me