Twitter Tools for wordpress

Twitter Tools is a plugin that creates a complete integration between your WordPress blog and your Twitter account.

Who is allowed to post a Tweet from within WordPress?

Anyone who has a ‘publish_post’ permission. Basically, if you can post to the blog, you can also post to Twitter (using the account info in the Twitter Tools configuration).

What happens if I have both my tweets posting to my blog as posts and my posts sent to Twitter? Will it cause the world to end in a spinning fireball of death?

Actually, Twitter Tools has taken this into account and you can safely enable both creating posts from your tweets and tweets from your posts without duplicating them in either place.

Does Twitter Tools use a URL shortening service by default?

No, Twitter Tools sends your long URL to Twitter and Twitter chooses to shorten it or not.

Can Twitter Tools use a URL shortening service?

Yes, Twitter Tools includes a filter:


as of version 1.6. Plugins for this filter may already exist, or you can create your own. The plugin needs to attach to this filter using the standard WordPress add_filter() function and return a URL that will then be passed with your blog post tweet.

Is there any way to change the ‘New Blog Post:’ prefix when my new posts get tweeted?

Yes there is, but you have to change the code in the plugin file.

The reason this is done this way, and not as an easily changeable option from the admin screen, is so that the plugin correctly identifies the tweets that originated from previous blog posts when creating the digest posts, displaying the latest tweet, displaying sidebar tweets, and creating blog posts from tweets (you don’t want tweets that are blog post notifications being treated like tweets that originated on Twitter).

To make the change, look for and modify the following line:

$this->tweet_prefix = 'New blog post';

Can I remove the ‘New Blog Post:’ prefix entirely?

No, this is not a good idea. Twitter Tools needs to be able to look at the beginning of the tweet and identify if it’s a notification from your blog or not. Otherwise, Twitter Tools and Twitter could keep passing the blog posts and resulting tweets back and forth resulting in the ‘spinning fireball of death’ mentioned above.

How to Get a WordPress API Key to Activate Akismet Plugin

Akismet is one of the plugins that every wordpress blogger use. Aksimet is free, regularly updated, comes inbuilt with
set up file and works like a charm. Once installed, Akismet keeps a close look on all comments made on your blog and if it suspects anything suspicious, it marks them as
spam and send to the spam folder. But many new users get confused when they try to activate Akismet and it asks for a API key to get activated. Don’t worry, API key for Akismet plugin comes for free and it takes just a minute to generate your unique
API key.

How to get Akismet API key

Remember that unless and until you get a
API key
, Akismet spam feature won’t work on your blog. However you can generate one Akismet key and use that on all your blogs to activate Akismet.

How to Activate Akismet

  1. Navigate to WordPress and sign up for a free account.
  2. When asked, select the second option – “Just a username, please.
  3. Akismet Api no

  4. After successful registration,
    will send a verification email to your email. Remember to provide actual email address.
  5. Open that email and scroll down to find
    .com API key
    . It looks like the below screenshot.
  6. Enter Akismet Api key to activate Akismet plugin

  7. Copy that API key and paste in your Akismet API Key field. Click on Update.
  8. Now you have got your Akismet plugin successfully verified.
  9. akismet verified

  10. You are done.

Remember to keep that email safe. You might need that API key no to verify Akismet on other

How to import a BlogSpot blog into WordPress

If you have a blog at and decide to switch your hosting to you can import all the posts and comments by using the WordPress Import feature. The automated process also has import functions for LiveJournal, Movable Type and TypePad, or another WordPress blog hosted elsewhere.

Although all the posts and comments get transferred, widgets in the sidebar are ignored. You would have to re-create those from scratch. Blogger ‘Labels’ are preserved as WordPress ‘Categories’.

To start the process go to the WordPress admin area and choose
Tools > Import. Then choose which blogging system you want to import from.

Please note: To use the importer with Blogger you must have a Google account and an upgraded blog. If you have an old-style Classic template you will need to switch to the new Blogger system (screenshot). The blog must be hosted on BlogSpot, not externally via FTP.

Step 1 – Authorize the transfer:

It would be helpful to login to your Google Account before you begin the import process. Then you can simply click the “Grant access” button and continue.

Step 2 – Select a blog to import:

If you have more than one blog attached to a single Blogger account all of them will be listed with an “Import” button for each blog. The example below shows just one.

Step 3 – Author mapping:

On Blogger you have one username, and on WordPress another username. The author mapping process allows you to establish an association between the two usernames.

Once these 3 steps have been completed the import proceeds automatically.

An experience of importing 2000+ posts

I was contacted by Kenny Smith, who wanted to replace a  pre-Blogger-in-Beta blog on his site. He sent a write-up of his experience:

“My Blogger blog was on an FTP-hosted site, so the first step was to temporarily convert that to Blogspot. That was easy to do inside the Blogger platform. I had more than 2,000 posts to move over to WordPress which was a problem because Blogger is capping the export at 500 posts now. Trial, error and Google searches taught me that I could export the whole thing to a WordPress hosted blog. So I simply created a and exported everything from – This was effortless.

The next problem, though, came when I tried to export to a hosted site. The step is to save the data from the site on your machine as an XML file. This is easily done within the WordPress platform. The problem was in trying to export that from desktop to After two days in tech support conversations with the WordPress folks (who were VERY helpful) we decided that my ISP was timing me out. So what I would see after trying to export 2,000 posts would be 1,734 or 1,722 or 1,755. This got frustrating quickly. Especially while deleting them all, 15 posts at a time.

The answer is a fairly simple one… … Take that XML file and segregate the data, perhaps by months or years if you’re dealing with thousands of posts, into several XML files to prevent the time out. WordPress’ tech people helped me break mine down into three XML files instead of the one I’d been trying and it all uploaded on the first attempt thereafter.

And now, the only really problem I have is an issue of the dates. Everything is written like it took place one day later than it really did. However, I seem to have 2,053 posts on the wordpress site, and I was trying to import 2,055. 99.9 percent is a nice success rate thanks to this extra step in the workaround and a little help from Nick at WordPress.”

Why switch to


The list of features in which outshines Blogger is quite long. They are summarized in this table: WordPress vs. BlogSpot. There are even more plus points for

  • Quite a few Blogger widgets added after 2006 depend on JavaScript. They won’t show up in many types of mobile device or browsers in which JavaScript is disabled. Google services rely heavily on client-side scripts which add significantly to download times. Outside towns and cities in America, Europe, and wealthy countries in South East Asia, broadband penetration has been minimal. Elsewhere, it’s confined to major cities. A 2007 article in PC World magazine noted that Rural America is doomed to Dial-Up. It looks like Google Inc. only cares about catering to city slickers in prosperous nations.
  • Since before Blogger-in-Beta was launched Google ignored some quite basic features that were requested by users in Blogger’s “Features and Suggestions Wish List” (replaced with a Google Group). No static pages, no post excerpts and no ‘import’ feature, except from another Blogger blog. The Blogger development team have spent a lot of time on script-dependent widgets and gadgets for the sidebar. Someone should remind them that content is king, not gimmicks. Widgets are nice, but it looks like “add-on” scripts are a higher priority than basic features.
  • Photo bloggers get a better deal with In posts, you can add a photo gallery with a single tag, and a Photoblogger Theme was added in April 2008. The Blogger alternative is to add a Slideshow widget to display thumbnails from Picasa Web Albums, which are unusable without JavaScript in any case.


  • I got fed up with a constant stream of spam comments for deletion in my WordPress dashboard. Especially as there were very few genuine comments for moderation. It’s true that if you ignore the Akismet spam queue they’ll be deleted automatically after a while, but it’s difficult to ignore them as a few might have been falsely tagged as spam.
  • Blogger makes it easy to change fonts and colors in themes. At you have to pay for an upgrade before you can do that.
  • It has been said elsewhere, but the dashboard Blog Stats really don’t compare to the free tracker scripts available from SiteMeter and StatCounter. The graph looks nice, but it’s done with Flash® so you can’t right-click to save it. The SiteMeter PNG-format bar chart looks great and includes a table of visits and page views for each day of the month. WordPress doesn’t identify the search engines which sent visitors and Search Engine Terms are cropped at 40 characters. I understand that unrestricted third-party scripts could be a security risk, but it should be possible to allow users to enter account parameters and generate safe code on the server. The StatCounter team would love to cooperate. They wrote about it on their blog:

For security reasons wordpress don’t allow you to install javascript code on blogs hosted by them i.e. blogs. We’re sure though that, if enough of you request the full StatCounter code on your blogs, then Matt & Co would be happy to oblige! We would certainly be happy to work with wordpress on this.

WordPress (Version 2.8.1) Released

The latest stable release of WordPress (Version 2.8.1) is available in two formats from the links to your right. If you have no idea what to do with this download, we recommend signing up with one of our web hosting partners that offers a one click install of WordPress or getting a free account on

What’s Next?

With our famous 5-minute installation, setting up WordPress for the first time is simple. We’ve created a handy guide to see you through the installation process. If you’re upgrading your existing installation, we’ve got a guide for that, too. And should you run into any trouble along the way, our support forums are a great resource, where seasoned WordPress experts volunteer their time to help you get the most out of your blog.


TYPO3 is a free Open Source content management system for enterprise purposes on the web and in intranets. It offers full flexibility and extendability while featuring an accomplished set of ready-made interfaces, functions and modules

The TYPO3 Association has released a new version of their very successful open source project. TYPO3 has been downloaded over 3.000.000 times from which makes it one of the World’s leading Enterprise Open Source products.

 The main focus of the new 4.2 version is improving usability, but there are also many enhancements for system administrators and developers. Including bug fixes, there are nearly 650 enhancements in TYPO3 4.2.
Read more…

Discover Nucleus CMS

Nucleus v3.41 Released

The Nucleus CMS core development team has released Nucleus CMS v3.41. This release fixes a bug in the configuration variables and has reordered English languages files to ease the translation. All changes can be found in the history of the included documentation (an online version can be found here).

There are no security updates in this release so that you have not to hurry up. But we recommend to update so that your blog software is up to date and work with all plugins.

March 16, 2009 – Permalink

CMS Toolbox: 80+ Open Source Content Management Systems


CMS Toolbox: 80+ Open Source Content Management Systems


A content management system, or CMS, is the easiest way to get a content driven site up and running fast. Frequently, they’re also used for building social networks. We’ve rounded up more than 80 popular CMSs due to reader requests. For the sake of brevity, we haven’t delved too deeply into CMSs for personal blogging or wikis (although we recommend WordPress and Mediawiki, respectively).

Editor’s note: Selecting a CMS is about selecting the right tool for the job. However, the most highly recommended general purpose CMSs tend to be Drupal and Joomla. We welcome your own recommendations and experiences in the comments.

Joomla – popular, award-winning CMS that will help you build powerful online applications.

XOOPS – extensible, easy to use; ideal tool for developing small to large dynamic community websites, blogs, portals and much more.

Drupal – equipped with a powerful blend of features, rich set of modules, very popular.

e107 – totally customizable content management system written in PHP using MySQL database.

Plone – ready-to-run, easy to set up, extremely flexible, and ideal for project groups, communities, websites, extranets and intranets.

Zope – an open source application server for building content management systems, intranets, portals, and custom applications.

PHPnuke – established CMS featuring web-based administration, surveys, customizable blocks, modules and themes with multilanguage support.

Dotnetnuke – port of PHPNuke into Microsoft .NET platform.

Typo3 – flexible and extensible CMS with an accomplished set of ready-made interfaces, functions and modules.

PostNuke – fork of PHP-Nuke to make it more secure, stable, and able to work in high-volume environments with ease.

SyntaxCMS – simplify publishing , create and edit site content online, and approve it before publishing to the web.

jLibrary is a DMS (Document Management System), oriented for personal and enterprise use.

V2 CMS – simple CMS, easy to install and modify.

Website Baker – PHP-based CMS designed to make website creation easy.

Jahia – use the Jahia community edition for publishing, managing files, and workflow.

eZPublish – created by eZ Systems, which has a team of professional software developers responsible for creating and maintaining the CMS.

Magnolia – makes Enterprise Content Management simple by being user-friendly, battle-tested, enterprise-ready and open-source.

WebGUI – built to give average business users the ability to build and maintain complex web sites.

OpenCMS – helps content managers worldwide to create and maintain beautiful websites fast and efficiently.

PHP-Fusion – a lightweight, small and versatile CMS.

Collaborative Portal Server (CPS) – most complete platform for building Enterprise Content Management applications, built on top of the Zope application server.

SiteFrame™ – lightweight content-management system designed for the rapid deployment of community-based websites.

TribalCMS – includes multilanguage support, template architectures, AJAX User Interfaces and unique administration.

Xaraya – create sophisticated web applications; designers enjoy considerable flexibility.

Krang – designed to publish magazine websites.

MMBase – CMS with strong multi media features and advanced portal functionalities.

Pligg – based on Menéame (Spanish Digg clone), Pligg enables you to create Digg-like sites.

elevateIT – an extension of ZOPE/Plone server.

Cofax – manages your text and multimedia content, and simplifies the presentation of newspapers.

DBPrism – first open source CMS based on Oracle XMLDB repository.

Flux CMS – XML/XSLT based, easy to use, extensible and suitable for developers to fill specific needs.

Apache Lenya – Java/XML based CMS that comes with revision control, multi-site management, scheduling, and workflow.

Rubricks – CMS for Ruby on Rails fans, boasts simplicity and speed.

Silva – built on top of Zope, enables you to export to Word, stream media, store content as XML, and manage hierarchical and traditional websites.

YACS – build your online blogging communities.

Clever Copy – A scalable website portal and news posting system.

Fundanemt – focused on usability and aimed at small and medium sized websites.

Dragonfly CMS – feature-rich open source content management system, based on PHP-Nuke 6.

ContentNOW – simple to use, flexible, multilanguage, modular CMS.

Bitweaver – suitable for large-scale community websites and corporate applications.

Elxis CMS – professional free open source CMS released under the GNU/GPL license.

Etomite – allows you to remotely administer your website from anywhere.

fuzzylime – simple way for you to run your site and keep it up-to-date.

iGaming CMS – build your own gaming websites.

MODx – CMS that helps you take control of your online content.

PHP comasy – simple, multilingual and fast content management system.

Mambo – very well-known CMS. Can be used for everything from simple websites to complex corporate applications.

Jupiter – one
of the most lightweight portal systems available.

Ovidentia – integrate an environment for publishing content on the www or a groupware portal.

Jaws – build your own modules on the powerful Jaws framework.

Geeklog – out of the box blog solution with support for comments, trackbacks, multiple syndication formats, and spam protection.

CMS Made Simple – make a home page for your family or your multinational corporation.

Eazy portal – solution allowing you to maintain your own online community.

Papoo – accessible content management system

phpWebSite – develop an interactive, community-driven website.

RunCms – portal system that includes most things a webmaster would expect from a CMS.

Exponent – allows site owners to easily create and manage dynamic websites without necessarily directly coding web pages, or managing site navigation.

SPIP – publishing system, use it freely for your own site, be it personal, co-operative, institutional or commercial.

Silverstripe – powerful enough for any website or intranet design and simple enough for anyone to use.

Pheap – created for folks who don’t like complex CMSs like Joomla and Drupal.

MDPro – an innovative and imaginative content management system.

TYPOlight webCMS – specializes in accessibility and uses XHTML and CSS to generate W3C/WAI compliant pages.

PlumeCMS – have multiple websites, multiple authors with different rights.

Xepient Open-Point – create a professional website quickly through the browser.

SlashCode – the original code for the Slashdot geek news service.

YaWPS – is a hybrid between a content management system and a web portal for medium or small-sized websites.

APC ActionApps – allow authorized users to easily update the content of their website.

Pagetool – suitable for people with limited technical skills to modify and contribute to an organization’s web site

OpenACS – toolkit for building scalable, community-oriented web applications.

ttCMS – build your community website with calendars, surveys, member management and authentication, file downloads, forum, articles, and announcements.

MySource – enables technically unskilled users to build and maintain their own web solutions.

Ariadne – web application server and content management system.

Mason CM – makes it easy to manage the workflow of information as it moves from staging to the live site.

Managee – comprehensive web based CMS.

ESY Web Builder – an intuitive content management system that allows non-technical people to create and manage websites and extranets.

PHProjekt – a groupware suite, for the coordination of group activities and to share information and documents via intranet and internet.

PROPS – extensible publishing system designed specifically for periodicals such as newspapers and magazines

Midgard CMS – internationalized set of tools for building web sites and networked applications.

Pivot – web-based tool to help you maintain dynamic sites, like weblogs or online journals.


Setup and configuration for New Blogger Tag Cloud / Label Cloud

Setup and configuration for New Blogger Tag Cloud / Label Cloud

Comments and Problems can be reported at the home post for this at
Code for New Blogger Tag Cloud / Label Cloud

Here is the code and setup information to use the Label Cloud in New Blogger.
First you obviously have to have a blog on New Blogger, and you MUST be using the
layouts templates,
(this isn’t available for classic templates, or FTP published blogs ) and you must have some posts labeled already. (There needs to be at least ONE label with more than ONE entry or the scripts hit a bug – so have at least one label with more than one entry before starting).

Make sure you backup your template before making any changes!

Log into Blogger and go to your layouts section. On the ‘Page Elements’ setup page
make sure you have a label widget already installed where you want it (it can be moved around
Then go to the Edit HTML settings and leave the widgets NOT exapanded. It will make
things easier to deal with.

Now the code comes in 3 parts. A section for the stylesheet, a configurations section,
and then the actual widget itself.

The first part to put in is the stylesheet section. The following code needs to be copied
and inserted into your stylesheet, which in the layouts is marked out by the <b:skin> tags.
Easiest thing to do is find the closing skin tag


 and place the code right BEFORE that.
Here it is, copy and paste without modification right now. I’ll explain what can be tweaked

/* Label Cloud Styles
———————————————– */
#labelCloud {text-align:center;font-family:arial,sans-serif;}
#labelCloud .label-cloud li{display:inline;background-image:none !important;padding:0 5px;margin:0;vertical-align:baseline !important;border:0 !important;}
#labelCloud ul{list-style-type:none;margin:0 auto;padding:0;}
#labelCloud a img{border:0;display:inline;margin:0 0 0 3px;padding:0}
#labelCloud a{text-decoration:none}
#labelCloud a:hover{text-decoration:underline}
#labelCloud li a{}
#labelCloud .label-cloud {}
#labelCloud .label-count {padding-left:0.2em;font-size:9px;color:#000}
#labelCloud .label-cloud li:before{content:"" !important}

This next section is the configuration section for the Cloud. It also goes in the head
of the template, but outside of the stylesheet part. Easiest thing to do again is to find
the closing stylesheet tag


But this time place the code right AFTER that line, but BEFORE the </head> tag. Here it is.

<script type=’text/javascript’>
// Label Cloud User Variables
var cloudMin = 1;
var maxFontSize = 20;
var maxColor = [0,0,255];
var minFontSize = 10;
var minColor = [0,0,0];
var lcShowCount = false;

All of these settings can be changed but I’ll explain them in a moment. The defaults will work for now.

Now the widget itself. Scroll down and find the label widget in your sidebar. It should look
something like this.

<b:widget id=’Label1′ locked=’false’ title=’Labels’ type=’Label’/>

Copy the following code (from beginning widget tag to ending widget tag) and replace
the line above with it.

<b:widget id=’Label1′ locked=’false’ title=’Label Cloud’ type=’Label’>
<b:includable id=’main’>
  <b:if cond=’data:title’>

  <div class=’widget-content’>
  <div id=’labelCloud’/>
<script type=’text/javascript’>

// Don’t change anything past this point —————–
// Cloud function s() ripped from
function s(a,b,i,x){
          var m=(a-b)/Math.log(x),v=a-Math.floor(Math.log(i)*m)

sp;         var m=(b-a)/Math.log(x),v=Math.floor(Math.log(i)*m+a)
      return v

var c=[];
var labelCount = new Array();  
var ts = new Object;
<b:loop values=’data:labels’ var=’label’>
var theName = &quot;<>&quot;;
ts[theName] = <data:label.count/>;

for (t in ts){
     if (!labelCount[ts[t]]){
           labelCount[ts[t]] = new Array(ts[t])
var ta=cloudMin-1;
tz = labelCount.length – cloudMin;
lc2 = document.getElementById(‘labelCloud’);
ul = document.createElement(‘ul’);
ul.className = ‘label-cloud’;
for(var t in ts){
    if(ts[t] &lt; cloudMin){
    for (var i=0;3 &gt; i;i++) {
         var fs = s(minFontSize,maxFontSize,ts[t]-ta,tz);
         li = document.createElement(‘li’); = fs+’px’; = ‘1’;
         a = document.createElement(‘a’);
         a.title = ts[t]+’ Posts in ‘+t; = ‘rgb(‘+c[0]+’,’+c[1]+’,’+c[2]+’)’;
         a.href = ‘/search/label/’+encodeURIComponent(t);
         if (lcShowCount){
             span = document.createElement(‘span’);
             span.innerHTML = ‘(‘+ts[t]+’) ‘;
             span.className = ‘label-count’;
          else {
         abnk = document.createTextNode(‘ ‘);

    <b:loop values=’data:labels’ var=’label’>
        <b:if cond=’data:blog.url == data:label.url’>
          <a expr:href=’data:label.url’><></a>
    <b:include name=’quickedit’/>


Now if all has gone well, and you have posts already labeled, then if you preview the
blog you should see some form of the Cloud appearing.
If it doesn’t appear, then something
went wrong.
You should probably back out and try it again from the start.

Update : I’ve found 2 things to check for first if the label cloud isn’t showing.  First make sure that at least one of your labels has more than one entry. A bug in the script causes it to fail when all the labels have only one entry.(As soon as any label has more than one entry, then it should be ok from then on) Also, make sure that none of your labels contain quote marks " .  Apostrophes or single ticks ‘ are ok. ——

Most likely the cloud with it’s default settings won’t be what you ultimately want. But all
the colors and sizes are configurable to match your tastes. If the cloud is appearing in preview
then you can go about changing some of the variables so they suit.

The settings in the Variables section will be where you make most of your adjustments. Here I’ll
explain what each setting does.

var cloudMin= 1;

This setting you can use to limit the number of labels shown (for example if you have a lot of labels). Leave the setting at 1 to show ALL labels.  If you enter in a higher number, then only labels that have at least that number of entries will appear in the cloud.

var maxFontSize = 20;
var maxColor = [0,0,255];
var minFontSize = 10;
var minColor = [0,0,0];
var lcShowCount = false;

The lines for

do what you may think they do. The first one sets the size (in pixels) of the label with the
most amount entries. The maxColor sets the color of that entry (in RGB format). Similiar with
the next two

Just these are for the label with the least amount of entries. Again the size is in pixels,
the color is in RGB format. Any labels between the two will get their color/sizes based on
how many labels they are, and where their entry count falls, giving the much desired cloud

From my experimenting, there are many factors that make up a pleasant looking cloud. From
color/size choice, to the number of actual labels, to how well dispersed the entries are amoung
the labels. 3 Labels don’t make a good cloud as there isn’t much to work with. You just have
to experiment around to see what looks good with your setup.

IMPORTANT, when change the color settings, Keep them in the format supplied. In between the [] and
the numbers separated by commas. The default colors are BLUE for the max and BLACK for the min.
You can select any valid RGB color combination. If you don’t know what RGB colors are, don’t
worry. It’s just a way of defining a color. You can use many charts on the Internet to
get the correct RGB value for the color you want to try. Here’s one that is fairly good.

RGB Color Code Chart

Remember, if you get the 3 sets of numbers to enter them in correctly. Inside the [ ] separated by

Also experiment with different font sizes. Again it depends on how many entries, how dispersed
they are, and how much room for the cloud is available as to what looks good.

The last variable there is


This can either be false (default) or true. All this does is turn off/on the post count displayed
next to the label. Usually in a ‘traditional’ cloud the count isn’t used. But if you go to a
‘flat’ listing then it’s sometimes useful to turn it on.

Now to the CSS section. Most people won’t need to tweak these much, and it’s not necessary to
understand what all those entries are for. Most are just to make sure that other styling
elements from the rest of your page don’t inherit in and ruin the cloud. But there are a few
that you may want to change to suit.
The first line

     #labelCloud {text-align:center;font-family:arial,sans-serif;}

You could change the fonts used in the cloud here if you wanted.
Also, the text-align statement can also be changed. I have it set to center by default but you
could use


If those suit better.

The next line

     #labelCloud  .label-cloud li{display:inline;background-image:none !important;padding:0 5px;margin:0;vertical-align:baseline !important;border:0 !important;}

Well don’t worry about most of it unless you are a hardcore CSS’er. The only one of real
importance is the first entry


You can change that to


To get the ‘Flat’ (each entry on it’s own separate line) listing of the weighted entries.
Usually if that is set to block you would probably want to change the sort frequency from
alphabetical to frequency.
You do that by editing the widget from the Page Elements tab in

And the last bit I’ll mention is the line

     #labelCloud .label-count

If you set the lcShowCount variable to true to show the post counts, you could change the
color/size of those numbered entries with that line.

Reference :

Creating Portlets for Web Sites With the NetBeans IDE

A portal is a web page that contains individual and customizable web applications. For example, My Yahoo is a portal page. The portal provides value-added services, such as single sign-on, customization, content aggregation, and localization.

Individual web applications that are added to the portal page are called portlets. A portlet is a Java technology web component that is based on the JSR 168 specification and JSR 286, which includes Web Service for Remote Portlets (WSRP). Portlets are managed by portlet containers that supply dynamic content. Portals employ portlets as pluggable user-interface components that provide users with desired content such as RSS feeds, mashups of services such as the current weather in a given area, or even static content such as a group of hyperlinks.

In the past, creating portlets was a complex process. Now, you can quickly and easily create and test portlets using the NetBeans IDE 6.0 and the OpenPortal Portlet Container 2.0 Beta 2. Deploying the portlets onto the server is also simple.

This article shows you how to create portlets and provide dynamic content through drag-and-drop widgets in the NetBeans IDE. The example portlet in this article uses the jMaki Tabbed View widget, pulls in RSS feeds, and uses static links from the New to Java Programming Center.

What You Need to Get Started

To create and test portlets, you need the following software installed on your computer:

For instructions on installing the OpenPortal Portlet Container 2.0 Beta 2, see the installation page. You must download and install the OpenPortal Portlet Container before you follow the next steps.

The portlet container works similarly to servlet containers. A portlet container does the following:

  • Provides the runtime environment for portlets
  • Manages the life cycle of portlets
  • Provides persistent storage for storing portlet preferences
  • Caches the portlets
  • Receives requests from the portal to execute requests on the portlet

Once you have installed the necessary software, start the NetBeans IDE. Next, install the portlet and portlet container plug-ins by following these steps:

  1. Go to Tools in the main menu.
  2. Select Plug-ins.
  3. Click on the Available Plug-ins tab.
  4. Check the boxes for Portlets, the OpenPortal Portlet Container, and jMaki Ajax Support.
  5. Click the Install button and follow the directions from there. You may need to accept a few licenses before the installation process can complete.

Lastly, add the OpenPortal Portlet Container server:

  1. Go to Tools in the main menu.
  2. Select Servers.
  3. Click on Add Server.
  4. Select OpenPortal Portlet Container 2.0 from the list.
  5. Click Next.
  6. Use Browse to set the location in which to install the GlassFish application server. You may need to search your system separately to discover where the NetBeans IDE installed the GlassFish application server.
  7. Click OK.

You are now ready to create a portlet.

Creating a Portlet Project

As you do whenever you create an application in the NetBeans IDE, go to File > New Project, and choose Web > Web Application, then click Next. For the name of this project, type New2JavaPortlet. In the Server drop-down menu, choose OpenPortal Portlet Container 2.0 Beta, then click Next. In the next screen, check the jMaki Ajax Framework box. In the lower half of the pane, you get a selection of layouts. Scroll to the bottom, and choose No CSS Style.

Lastly, at the top of the screen, check the Portlets Support box. Use the Portlet Version drop-down menu and select 2.0, then check the Create Portlet box. In Portlet Class Name, type New2JavaPortlet. Note that the project name and the portlet name must be the same. The other fields are filled in automatically. Click Finish.

Because of the way that portlets are set up within the container, you will not need the displayed index.jsp page. On the left side of the screen, under the Projects tab, you see index.jsp listed. Right-click on index.jsp and select Delete. The file you are going to work on is named New2JavaPortlet_view.jsp. You can find that file by expanding the WEB-INF directory, then the jsp directory. Double-click the file name New2JavaPortlet_view.jsp The file now opens in the workspace.

How the Java Portlet Works

Even though all you’ve done is create a portlet project, the NetBeans IDE has already written an essential class for you. From the Projects tab, expand the Source Packages. Then expand com.text, and open the file by double-clicking the file name.

The New2JavaPortlet extends a GenericPortlet class, which is provided, that implements the render() method and delegates the call to more specific methods to display the portlet based on its mode. Developers can extend GenericPortlet and implement as many of the following specialized render methods as are necessary for their portlet:

  • doView() Called by render() when the portlet is in View mode. Intended to contain logic that displays the View page for the portlet.
  • doEdit() Called by render() when the portlet is in Edit mode. Intended to contain logic that displays the Edit page for the portlet.
  • doHelp() Called by render() when the portlet is in Help mode. Intended to contain logic that displays the Help page for the portlet.

Notice that the New2JavaPortlet calls these methods, locating the pages for each. In this article, you will put the content of the portlet in the View page through drag-and-drop widgets and some HTML code. But you can extend this GenericPortlet cl

ass for other portlets. You can also go back later and modify the Edit or Help page. Once you have had a good look at the New2JavaPortlet class, you can close it.

When you build and run the portlet, the browser will display the New2JavaPortlet_view.jsp. Currently, this page contains only the static text: New2JavaPortlet – VIEW MODE. Because it is a JavaServer Pages (JSP) technology page, you can add any scripts or JSP tag libraries that you wish, and treat it like any other JSP page.

Test your portlet environment now before adding more content: From the main menu, click Build and select Build Main Project. Once the build is successfully completed, go to the main menu and click Run. Select Run Main Project. This takes a little longer as the application server is started, the portlet container is started, and a browser window is opened.

Notice that the portlet project name is the same as the portlet itself. Once you see that your development and testing environments are working properly, you can add content to replace the static text on the New2JavaPortlet_view.jsp page. To see the changes that you make to your portlet, you undeploy and deploy the portlet, as explained in the next section.

Adding Dynamic and Static Content to the Portlet

Because this portlet will contain several kinds of content, organize the content for a small area on a web page by using tabbed panes. You can choose other types of layouts, of course, but for this example, use the jMaki widget named Tabbed View. On the right side of your screen, notice that you have many available widgets to drag and drop. Check to be sure that the jMaki Yahoo widgets list is expanded .

Within the workspace page, delete the static text that says New2JavaPortlet - VIEW MODE. Also, delete the surrounding HTML code for bold: <b></b>. Now drag and drop the Tabbed View widget, shown highlighted in white , from the palette onto the page, exactly where you have just deleted text. Once you have dropped the Tabbed View widget onto the page, the following code appears on the page:

<a:widget name="yahoo.tabbedview"
           {label : 'My Tab', content : 'Some Content'},
           {id : 'bar', label : 'My Tab 2', include : 'test.jsp ', lazyLoad : true },
           {label : 'My Tab 3', content : 'More Content',  selected : true}
         }" />

The action of dragging and dropping a jMaki widget onto the page causes the creation in the resources directory of all the files necessary to build that widget.

To get an idea for how this widget works, save the file. Next, right-click the project name in the Projects pane and select Undeploy and Deploy. Once it is built, run the project: Go to the main menu, click Run, and select Run Main Project. When the project runs, your changes appear in the browser window. Click on each of the tabs in the Tabbed View pane. Notice on the tab named My Tab 2 that the file test.jsp was not loaded. This is only because a test.jsp had not been created, but it does demonstrate how you call a JSP page to appear in the pane.

For the New2JavaPortlet, you are going to create new JSP pages that the widget will call. Each of these pages provides the content for each of the tabs. On the New2JavaPortlet_view.jsp page, replace the code shown earlier with the following code:

<a:widget name="yahoo.tabbedview"
           {id : 'bar', label : 'Popular & New', include : '/New2JavaPortlet/whatsnew.jsp ', selected : true },
           { label : 'Java Fundamentals', include : '/New2JavaPortlet/fundamentals.jsp ', lazyLoad : true },
           { label : 'Downloads', include : '/New2JavaPortlet/downloads.jsp ', lazyLoad : true },
         }" />

This code calls three JSP pages: whatsnew.jsp, fundamentals.jsp, and downloads.jsp.

The next step is to create those pages. In the Projects pane, right-click on Web Pages. Then select New, and lastly JSP. Notice that you are saving these pages into the Web Pages directory, not the jsp directory that the portlet container created for the New2JavaPortlet_view.jsp. Any JSP pages that you create must go into the Web Pages

Create three JSP pages in this manner, naming them whatsnew, fundamentals, and downloads. The NetBeans IDE automatically adds the .jsp extension, so don’t include that in the file name.

Next, run Undeploy and Deploy again. Then click on the Run menu, and select Run Main Project. This time, note that the tab names have changed. As you click on each tab name, you get the JSP pages that you just created because of the code you replaced. Open each of these JSP pages — downloads.jsp, fundamentals.jsp, and whatsnew.jsp — and add content as described in the following subsections.

The downloads.jsp Page

This page contains simple static content, a title, and a list of links. Do not change the first two lines of code that appear at the top of the page:

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

But replace all of the HTML code with the following:

<h3>Downloads for New Developers</h3>
  <li><a href="">Java SE (JDK)</a>
  <li><a href="">NetBeans IDE</a>
  <li><a href="">MySQL Database</a>

The fundamentals.jsp Page

This page will provide dynamic content, pulling in an RSS feed. Again, leave the first two lines of code alone, and remove all of the HTML code. Next, from the jMaki Widgets palette on the right side of the display, drag and drop the Block List widget onto the page.

The following code should appear on your page:

<a:widget name="jmaki.blockList" value="[
{title : 'jMaki Project Home', link : '', description : 'Where to go for the latest jMaki.' },
{title : 'jMaki Widgets Home', link : '', description : 'The source for the latest jMaki widgets.' },
{title : 'jMaki-Charting Home', link : '', description : 'Enables complex charts rendered on the client in any modern browser.' }
]"  />

The widget prov

ides placeholder text only. Replace everything with the following code:

<h3>Java Technology Fundamentals</h3>
<a:widget name="jmaki.blockList" service="/xhp?id=rss"  />

In order to populate the widget with data from an external service, such as an RSS feed, you must replace the value attribute with service="/xhp?id=rss". If any page consists of a jMaki widget, then the jMaki runtime is bundled with the application. The runtime consists of jmaki.xhp.XmlHttpProxyServlet class that maps to the /xhp URL pattern within the application context.

The identifier or ID specified in the URL, rss, is configured in a configuration file named xhp.json. This file consists of a list of default external services that the widgets in a page can access. You can specify each entry in the xhp.json file by using up to five different parameters:

  • ID: This required parameter is a unique identifier for the entry.
  • URL: This required parameter gives the location of the external service.
  • Parameters: These optional parameters specify the default values passed to the URL.
  • API key: This is an optional parameter to invoke the service with a specific key.
  • Stylesheet: This is an optional parameter to process the response.

Next, you must change the xhp.json file. Go to the Projects tab and expand the resources directory. Double-click the file xhp.json, and scroll to the bottom of that page. Search for this code in the xhp.json file:

{"id": "rss",
      "xslStyleSheet": "rss.xsl"

The tag and the default entry tell the jMaki runtime to fetch the RSS feed from, apply the rss.xsl stylesheet — which understands the multiple RSS/Atom formats — to the received response, and convert the data into a common JavaScript Object Notation (JSON) data format of the type "dataType" : "jMakiRSS". The jMaki Block List widget can convert jmakiRSS data to its specific data model.

But the intention of this article is not to pull in Ludovic Champenois’s blog. So change the URL of to

Additionally, you will pull in another feed on the whatsnew.jsp page, so change the URL in the code as shown in the following code snippet. The new URL is highlighted in red.

{"id": "rss2",
      "xslStyleSheet": "rss.xsl"

Notice that the ID for the second RSS feed to pull in is named rss2. Notice also that the URL pulls in the blogs from the “What’s New” section of the New to Java Programming Center. Save the xhp.json file. Because you’ve added another block of code to pull in the second feed, you must separate the two
with a comma after the closing curly bracket (}) of the first block. The following code snippet shows the added comma in red on the fourth line:

    {"id": "rss",
      "xslStyleSheet": "rss.xsl"
    {"id": "rss2″,
      "xslStyleSheet": "rss.xsl"

The whatsnew.jsp Page

Go to the whatsnew.jsp page, and delete the HTML code. Add the following static HTML code:

<h3>What's Popular</h3>
  <li><a href="">The Java Tutorial</a></li>
  <li><a href="">Java Technology Fundamentals</a></li>
  <li><a href="">Core Tech Tips</a></li>
  <li><a href="">Easy Web Site Creation in the NetBeans IDE</a></li>
  <li><a href="">The Java EE 5 Tutorial</a></li>
<h3>What's New</h3>

Next, from the jMaki Widgets palette on the right side of the display, drag and drop the Block List widget onto the page. Change the code as shown here:

<a:widget name="jmaki.blockList" service="/xhp?id=rss2"  />

Customizing the jMaki Widgets

All the files that you need for customizing any of the widgets are available in the resources directory by widget name. In this case, look under jMaki for the files for the block list. Expand the blocklist directory, and open the file called component.css.

Change the line that says height : 85px; to height : 25px; and save the file.

Next, open the component.html file, and delete the following code from it:


This removes the descriptions from the RSS feeds, leaving only the title as a link. You can also add content, such as a date, by adding it to this file. Now, save all the files, click Undeploy and Deploy, then run the portlet again by clicking on Run in the menu and selecting Run Main Project.

Again, click Undeploy and Deploy. Then click Run the application. You now see the pages that you

‘ve created with the content. Notice also that the block list is taking up a lot of room. You can customize jMaki widgets easily by going to the Projects tab, expanding the resources directory, expanding the jMaki directory and then blockList. Edit component.css so that the height is just 25 pixels (25px).

Click Undeploy and Deploy again. When you run the portlet.

Your portlet is now complete. Once the portlet is deployed, users can add the portlet to their portal page and have access to the information they want on their page. You can tailor portlets in many different ways to suit the needs of your web site. The NetBeans IDE provides many widgets that you can drag and drop, but you are not limited by what that palette provides. You can also create your own widgets, or use Java code to create an unlimited number of objects to get the functionality that you want.

The next step is to archive the entire project in a ZIP file and send it to the server administrator. If you are also the server administrator, read the next section.

Packaging and Deployment

The portlet specification specifies the packaging and deployment of portlets as part of standard Web Application Archive (WAR) files that may contain other web components, such as JSP pages and servlets. In addition to the web.xml deployment descriptor now found in WAR files, the portlet.xml file in the WEB-INF directory descriptor defines all portlets and portlet-related configurations. An XML schema included in the portlet specification JSR 168 defines the standard elements for portlet configuration stored in the portlet.xml file.

Each portal-server vendor must provide a tool to parse the portlet descriptor file and deploy the portlet. These tools likely exist in GUI form as well as in command-line form. Developers will be able to integrate the command-line deployment tools with the Apache Ant tool. This creates additional development environment possibilities, because most development tools provide an interface for Apache Ant.

To deploy the project onto the server, see the documentation for your portal server for complete details. Most portal servers will allow you to deploy the WAR file, which is located in your project’s dist directory after you perform a build. Depending on your portal server, this may be deployed by using the Ant command, copying the WAR to your portal autodeploy directory, or using the administrative feature of your portal server.


Now that you have created a portlet, you can create other types of portlets for the portal page for your users. Portlets can include components such as local weather, the latest news, live sports scores, maps, and RSS feeds from other sites. Portlets allow your users to customize the web page to meet their specific needs, and this keeps them coming back to your web site.

For More Information