Hello FeedBurner

July 20th, 2010

So, Yahoo Pipes appar­ently had issues deal­ing with the wack­ness that is Deli­cious’ RSS feeds.  I switched over to Feed­Burner and things seem to be func­tion­ing as expected.  We will see how long this lasts…

Updated RSS code

July 14th, 2010

For some rea­son, the Yahoo Pipes code that I started using yes­ter­day worked for about a day and then… well, it stopped.  So, I decided to look and see if there was a bet­ter way of inte­grat­ing RSS, and I found it.  Not sure why the older code stopped work­ing, but this new code works, and that is what matters.

		<?php while (have_posts()) : the_post(); ?>
			<?php $count++; ?>
			<?php if ($count == 2) { ?>
				<?php // Get RSS Feed(s)
					include_once(ABSPATH . WPINC . '/rss.php');
					$rss = fetch_rss('http://pipes.yahoo.com/pipes/pipe.run?_id=44e48ee3d0fdba8a428ae7eec11f42fe&_render=rss');
					$maxitems = 5;
					$items = array_slice($rss ->items, 0, $maxitems);
					?>
					<div id="bookmarks">
						<h2>recent delicious bookmarks</h2>
						<ul>
							<?php if ($items == 0) echo '<li>No items.</li>';
							else
							// Loop through each feed item and display each item as a hyperlink.
							foreach ( $items as $item ) : ?>
								<li>
									<a href='<?php echo $item['link']; ?>' title='<?php echo $item['title']; ?>'>
										<?php echo $item['title']; ?>
									</a>
								</li>
							<?php endforeach; ?>
						</ul>
					</div>
			<?php } ?>

			<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
			...
			<?php endwhile; ?>

This updated code came from the book Smash­ing Word­Press: Beyond the Blog, which I picked up at my local library today.  Looks to be a great read for those inter­ested in Wordpress.

RSS mixer service update

July 12th, 2010

Most of the RSS aggre­ga­tion ser­vices listed here are either no longer in ser­vice or are expe­ri­enc­ing some level of grow­ing pains.  RSS Mix, which is the ser­vice that I used to ‘remix’ my Deli­cious RSS feed  has been act­ing up the last cou­ple of times I have checked, so I decided to upgrade to a more well known player. And yes, I had to use a third party ser­vice to aggregate/translate a sin­gle feed because Deli­cious’ RSS is wacky (at least as far as Sim­plePie is concerned).

Wel­come Yahoo Pipes.  My home page RSS works like a charm now, and I have lit­tle fear that this ser­vice will dis­ap­pear overnight.

Makes me won­der what is next.  Let­ting Google host my jQuery or site fonts?  That is just crazy.

Blog Freshness fix

June 10th, 2010

I imple­mented the lat­est ver­sion of Blog Fresh­ness into my blog theme and while test­ing I came across a minor issue that has now been fixed.  The new ver­sion is avail­able for down­load below.

Down­load Blog Fresh­ness 1.2

Blog Freshness 1.1 — now with widget support

June 1st, 2010

I updated the Blog Fresh­ness plu­gin to sup­port wid­gets.  So now you can place Blog Fresh­ness any­where you can place wid­gets, instead of hav­ing it locked in the upper-right cor­ner.  There are also a cou­ple of options that allow you to change the title and align­ment (left, cen­ter, right) inside the wid­get area.

Down­load Blog Fresh­ness 1.1

Dreamweaver CS5 and CMS integration overview

May 4th, 2010

Lynda.com has a video overview on the new CMS inte­gra­tion fea­tures of Dreamweaver CS5.  Use the link below and then select the ‘Work­ing with CMS frame­works’ video link.  Looks to be useful.

Dreamweaver CS5 New Features

Drupal 7 theming preview

May 4th, 2010

Here is a nice write-up about the upcom­ing changes to them­ing in Dru­pal 7.

A peek at Dru­pal 7 theme sys­tem changes

Passing data from Drupal to jQuery

April 22nd, 2010

It is fairly sim­ple to pass infor­ma­tion from Dru­pal (PHP) to jQuery (JavaScript). I have recently used this method to have jQuery ani­mate ele­ments using CCK fields for the con­trol data (direc­tion, dis­tance, speed, etc.).

First, open up node.tpl.php in the root of your theme direc­tory and paste the fol­low­ing code at the bottom:

<?php
	drupal_add_js(array('title' => $title,
						'logged_in' => $logged_in,
						), 'setting');
	drupal_add_js(path_to_theme().'/js/drupal_js.js');
?>

The first line of the PHP code cre­ates the set­ting array that Dru­pal will use to pass infor­ma­tion to jQuery. The sec­ond line cre­ates a ref­er­ence to the exter­nal JavaScript file that we will cre­ate in the next step.

Cre­ate a new JavaScript file called drupal_js.js and place it in a /js folder in the root of your theme. Paste the fol­low­ing code into drupal_js.js (replace ‘myThe­me­Name’ with your actual theme name on the first line):

Drupal.behaviors.myThemeName = function(context) {
	alert('Title: ' + Drupal.settings.title + '\nLogged in: ' + Drupal.settings.logged_in);
}

The first line of the JavaScript code is the Dru­pal replace­ment for the stan­dard jQuery ‘$(document).ready(function() {‘. You can use it with either a theme (Drupal.behaviors.myThemeName) or a mod­ule (Drupal.behaviors.myModuleName).

Next, we cre­ate an alert using the Dru­pal vari­ables from the set­ting array. In order to ref­er­ence the vari­ables, you need to tack ‘Drupal.setting.’ on the front of the vari­able name.

When you view a page that is using node.tpl.php you should see a JavaScript alert pop up that states the title of the node and the logged in sta­tus of the cur­rent user.

Adding RSS feed content in Wordpress 2.8+

March 24th, 2010

With Word­press 2.8+, there is a new func­tion, fetch_feed(), that is built off of Sim­plePie. The new func­tion worked fine with most RSS feeds, like the one from my blog here, but it would error out each time I attempted to get it to read a feed from Deli­cious.  After mak­ing sev­eral attempts, and com­ing up empty on Google searches, I decided to switch gears.  Instead of get­ting the feed directly from Deli­cious, I found a feed aggre­ga­tor site called RSS­Mix, cre­ated a mix with just the feed I wanted from Deli­cious, and then used that feed URL to great suc­cess.  The code for my feed dis­play is below:

<?php
// Get RSS Feed(s)
include_once(ABSPATH . WPINC . '/feed.php');

// Get a SimplePie feed object from the specified feed source.
$rss = fetch_feed('http://www.rssmix.com/u/800770/rss.xml');
if (!is_wp_error( $rss ) ) : // Checks that the object is created correctly
	// Figure out how many total items there are, but limit it to 5.
	$maxitems = $rss->get_item_quantity(5);
	// Build an array of all the items, starting with element 0 (first element).
	$rss_items = $rss->get_items(0, $maxitems);
endif;
echo $postcount;
?>
<div id="bookmarks">
	<h2>recent delicious bookmarks</h2>
	<ul>
		<?php if ($maxitems == 0) echo '<li>No items.</li>';
		else
		// Loop through each feed item and display each item as a hyperlink.
		foreach ( $rss_items as $item ) : ?>
			<li>
				<a href='<?php echo $item->get_permalink(); ?>'
				title='<?php echo 'Posted '.$item->get_date('j F Y | g:i a'); ?>'>
				<?php echo $item->get_title(); ?></a>
			</li>
		<?php endforeach; ?>
	</ul>
</div>
<?php } ?>

In order to get the feed to dis­play after the first post, I used the fol­low­ing code:

<?php if (have_posts()) : ?>
	<?php $count = 0; ?>
	<?php while (have_posts()) : the_post(); ?>
		<?php $count++; ?>
		<?php if ($count == 2) { ?>
        	<!-- RSS CODE HERE -->
		<?php } ?>
		<!-- STANDARD WORDPRESS LOOP STUFF HERE -->

Opening Drupal node/page content in a lightbox

March 23rd, 2010

I have worked with dif­fer­ent types of light­box imple­men­ta­tions before,  usu­ally to view images or videos, but recently I needed to fig­ure out how to open up Dru­pal con­tent, either node or page con­tent, in a light­box instead of redi­rect­ing to a new page.

This page on the Drupal.org site is a good start­ing place if you are attempt­ing to use a light­box, namely Lightbox2, to dis­play Dru­pal content.

Lightbox2 — How to add a light­box to web­page links

p.s. My blog con­tent went moldy on me.  I guess there isn’t much shame involved when my site con­tent gets old and nobody is around to see it.