We received such a positive reaction after the release of the Ryboe Tag Cloud for WordPress Plugin. It seems that there are many people out there with WordPress blogs who are looking for a simple and elegant tag cloud to show off their category tags. Well, we are pleased to announce that we have added a nice little enhancement to the plugin in the form of an update — version 1.01.

We received a few emails from individuals who wished to use the tag cloud on their blog, however they were not using the default WordPress structure for category links. The original version of the plugin relied on the fact that the user was able to link to their categories in the following format:

<a href="/category/php">PHP</a>

However, it became apparent that many users could not use these nice "slug" links due to limitations of their web server (mod_rewrite issues, etc) or general favor in defining the links using the category ID in the following format:

<a href="/?cat=1">PHP</a>

We have included an option in the Ryboe Tag Cloud widget so that you may choose to "Use Nice Category Links". This option is a simple checkbox that you can select to use the SEO-favored slug method. If you leave the box unchecked, it will simply link using the category ID.

WordPress Tag Cloud Options

Download the newest version of the Ryboe Tag Cloud Plugin for WordPress

Enjoy!

In the new tutorial, Using PHP Headers to Force Download, we briefly go over how to use the header() function in PHP to set HTTP raw headers to define application type. This is useful when providing downloads on your website and you don't want to risk the user's browser trying to handle the file with default plug-ins and applications. Check it out!

post entry

Valid Flash in Firefox

Posted on January 13th, 2007 in Firefox, Flash, Netscape, W3C, XHTML

In working on getting Ryboe.com to correctly validate tonight, I ran across an interesting tidbit about Flash movies and the W3C. The <embed> tag was created by Netscape as a way to get Flash objects to play in their browser. The problem with this Netscape-invented <embed> tag is that the W3C does not recognize it as a valid XHTML tag. If you are like me and would like for your site to validate, you have to remove it. So how do you get your Flash files to play in Firefox, Netscape, etc. and still have your site validate? Well, after doing some digging, I found that the solution is actually quite simple.

In this case, I have an image slideshow Flash movie that I want to display. Here is what the HTML embed code used to look like to show the Flash:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="580" height="225" id="slideshow" align="left">
<param name="movie" value="slideshow.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="transparent" />
<embed src="slideshow.swf" quality="high" bgcolor="#ffffff" wmode="transparent" width="580px" height="225px" name="slideshow_as2" align="left" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>

In this article, entitled Embedding Macromedia Flash While Supporting Standards, Drew McLellan talks about his experience in dealing with this exact issue.

Just strip the <embed> tag altogether and place an extra definition of the Flash file path within the opening <object> tag. A "type" attribute is used to define that you want the Flash movie to play with the Macromedia Shockwave-Flash player. Here is my final code:

<object type="application/x-shockwave-flash" data="slideshow.swf" width="560" height="225" id="slideshow" align="left">
<param name="movie" value="slideshow.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="wmode" value="transparent" />
</object>

By defining the path to the Flash file again with the "data" attribute, my movie plays fine!

Familiar with seeing tag clouds around the net?  Would you like to display the content on your WordPress blog as tags and tag clouds respectively.  Then look no further.  We have released the first version of the Ryboe Tag Cloud Plugin for WordPress. This plugin uses the WordPress widget system to place a tag cloud in your sidebar.  With a fast and easy install, you can quickly convert your categories to "tags" and have a tag cloud in your sidebar in no time!

Download the Ryboe Tag Cloud Plugin

Here's how to install it:

  1. Make sure you have WordPress Widgets installed on your .blog. If you don't, go ahead and head here for official instructions on how to install WordPress widgets. Note** The download link is on the left side of that page.
  2. After verifiying that you have WordPress Widgets installed, download the Ryboe Tag Cloud Plugin for WordPress.
  3. Unzip the file and copy it to your /wp-content/plugins/widgets directory with all of your other widgets.
  4. Log into your WordPress Dashboard and head to the "Plugins" menu. Find the plug-in entitled "Ryboe Tag Cloud" and select "activate"
  5. Navigate to Presentation -> Sidebar Widgets and drag the "Ryboe Tag Cloud" onto your sidebar layout. (Be sure to change your title here if you wish to have one).
  6. Visit your blog to see your new tag cloud!

It's that quick and easy.  Now you have a slick little tag cloud of all your post categories on your sidebar!

In the world of buzzwords like Web 2.0 and Ajax, everybody is trying to get a grasp on the stylish quirks you see from website to website.  Back in the tutorial Getting Ready for Web 2.0 effects with Scriptaculous we talked about firing up a JavaScript effects framework on your server for future UI and display purposes.  Scriptaculous is immensely powerful and today I'd like to show you a quick example of how this framework can make your life easier.

One ever-so-popular effect that you commonly see used across the web is the highlighting of an HTML element with a nice yellow highlight fading back to the original background.  I have recently run across some interesting techniques that individuals were using to create this effect.  I briefly skimmed over this particular tutorial in question and was absolutely amazed at the amount of effort this individual had put in to create a multiple step animation sequence for changing the background colors of a DOM element.  (Basically, somebody needs to introduce this guy to the Scriptaculous library.)

In case you're in the dark on how to create a nice Highlight effect, here's an easy manner in which to do so using the form we created in the Error Output With Scriptaculous

Simply find the line:

<input type="text" size="30" id="email" />

Take this line and change it to:

<input type="text" size="30" id="email" onblur="new Effect.Highlight(this, {startcolor: '#ffff00', restorecolor: 'true'})"/>

What's going on here?  Well we are using the onblur element listener to trigger JavaScript when the user moves their focus from the input box in question.  The JavaScript included in the quotation marks simple creates a new Effect called Highlight and sets a few arguments.  "this" is used to identify the HTML element we are running the effect on.  (We can use "this" since we are defining the JavaScript in-line.)  The options "startcolor" and "restorecolor" are set in the next part of the JavaScript declaration.  Using a hex code, we can tell Scriptaculous exactly what color we want the animation to start with.  The "restorecolor" parameter is handy because it will return the background color of the element to its original color without us having to worry about what the initial value was.

View Yellow Fade Technique Example. The effect will trigger when you place your cursor in the "email" box and tab to the next field or click elsewhere on the page.

Note** There are other options you can define here, refer to the official Scriptaculous documentation for more information.

Continuing on from yesterday's tutorial, Error Output With Scriptaculous, in which we got started with a nice little login form showing off simple validation and error output with Scriptaculous, I decided today we would add onto that form a little bit.  One neat thing that you can accomplish in creating your forms in HTML is the use of a custom "submit button". 

By defining your submit button as an image, you can use any image file to replace the standard grey HTML button you see sprinkled all over the web.  In order to do this, you simply change the HTML code you use in your form.

Previously we were using the code:

<input type="submit" value="Login" />

Now obviously, this got the job done but we would like for our site visitors to have a nice themed experience when logging in, so let's style it up!  To do so, simply change the "type" attribute and define a "src" attribute on your input element, leaving your code looking like

<input type="image" src="./images/submit_button.jpg" />

The "src" is the path to the image you want to use.  I decided I wanted to spruce things up a little more and give the submit button some flare, adding a rollover state to it.  In order to do so, I first prepped my image file in Photoshop, leaving me with a two state image:

submit button

As you can see, both the on and off states are visible in this image. Why wouldn't I separate them out into individual image files?  Well the answer is, there is no need to with the use of CSS (and afterall, I'd rather only have to worry about loading one image on the client side than two).

How exactly is this accomplished?  Well for starters, we need to simplify the markup for our submit button.  Start by changing the attributes of the "input" element, defining "type","class", and a blank "value":

input type="submit" class="submit" value="" />

Before the CSS is added, we are left with a small non-user friendly button.  By defining the "submit" class that we just attached to our "input" element, we can all at once implement our image as the button.

.submit
{
    background: url(./images/submit_button.jpg) no-repeat;
    height: 42px;
    width: 130px;
    border: none;
}

In this CSS class we are setting the background image, height and width, and stripping the element of its default browser-styled HTML border.  The button is perfectly functional!  However, we still want to add the hover state.  In order to do so, we simply need to define a hover state for the "submit" class.

.submit:hover
{
    background: url(./images/submit_button.jpg) 0 -42px no-repeat;
}

In this code, we are leaving all the attributes the same except for the background property, which we are adjusting the background position with a height of -42px.

View Image as a Submit Button with Hover Example

Voila!  There you have some nice little CSS submit button magic.  Note, the hover state will not work in Internet Explorer 6, which does not recognize :hover classes in CSS.  There is an easy way to work around this, which I will uncover in the not so distant future.

With the release of the new Scriptaculous 1.7.0 Beta, Thomas Fuchs has introduced a new effect, morph.  The syntax for this new feature is quite easy to grasp.  Simply call the function on the element you wish to morph.

$('my_element').morph();

You can also pass this function arguments to define CSS properties on the fly.

$('my_element').morph({fontSize: '12px', color: '#7F1123'});

Here is an example of the Scriptaculous morph function and how it can be used.

The code I used in my example was quite simple.  I set some default values in CSS for the element I was going to morph.  Then I created some anchor text, in which I tacked on a onclick behavior that called the morph() function.  This is what my markup looks like:

<div id="change_me">Watch me morph!  Click Below!</div>
<a href="#" onclick="$('change_me').morph({fontSize:'36px',color:'#7F1123'}); return false;">Click Here</a>

The magic is primarily done in defining the initial CSS values and passing your new ones to the function.  Pretty handy!

Note– using this method requires the newest beta release of Scriptaculous.  The download is available toward the bottom of this page on mir.aculo.us.  Direct download link.

In this tutorial, Error Output with Scriptaculous, we discuss how to get a basic Scriptaculous effect up and running. This tutorial shows how to properly set up HTML markup so that JavaScript can effectively interact with the DOM and use the Effect.Appear method to display error output. This example centers around a simple login form that validates user input.

A new tutorial has been added entitled Getting Ready for Web 2.0 Effects with Scriptaculous. In this tutorial, you can gain a general overview of the Scriptaculous library for JavaScript and what it is used for. Then, the tutorial gives you detailed instructions on how to get Scriptaculous up and running on your web server. It's pretty easy so get started today!

post entry

Remove Fancy Quotes in WordPress

Posted on January 6th, 2007 in WordPress

As I am working on the site here, I have noticed a behavior of WordPress that is indeed annoying. By default, WordPress renders quotes as the fancy style of quotes. Usually this would not be an issue as they are awfully pretty quotation marks, curving according to their placement on the string. However, when using code examples, this is not a desirable effect as it will keep users from being able to copy & paste code examples for their own use.

The Problem. How do I remove fancy quotes from my posts in WordPress?

The Fix. In an effort to fix this problem I came across an easy fix. The folks over at semiologic.com have put together an easy to install plugin for WordPress enttitled "Unfancy Quote Plugin". The plugin is a single PHP file that you need to upload to your /content/plugins directory in your WordPress install. Once you have it uploaded just head over to the admin panel and activate the plugin! Presto!

Unfancy Quote Plugin for WordPress

How does it work? Well it's actually quite simple. The plugin utilizes the PHP str_replace() function to seek out instances of the fancy quotes in strings and replaces them with standard quotes. This is possible by using the HTML entities codes for the corresponding quotation marks.