List/Display YouTube Videos With MagpieRSS

May 5th, 2008

Late last year, Google made a switch from the old YouTube API and integrated it into it’s GData API. While an understandable move, it does somewhat annoy me that the old REST method is being depreciated in August 2008 because I don’t particularly feel like updating my code :)

Alas, it will happen soon, and so I decided to upgrade some pages that used it. As I don’t heavily rely on the video services, and just use it in it’s simplest form for displaying a list of Videos, I made something quick, rather than install the Zend GData Library Google recommends.

Since GData outputs RSS, I used MagpieRSS to painlessly port my old code and have an updated code up and running. Here’s two scripts that may help with your changeover: Read the rest of this entry »

Table of Contents generator for anchors with MooTools

May 3rd, 2008

For those pages with loads of text a table of contents would be nice, with anchors located in relevant sections. Thing is that going through a page with thousands of words and headings is no fun at all.

I made a script using the lovely MooTools that gets all the elements with a given CSS selector (using the Elements.Selectors syntax) and then builds an unordered list of links, with the element text as the title, and an anchor placed in that element. Read the rest of this entry »

Do search engines index the same page more than once?

May 1st, 2008

I ran into an interesting point recently which arose while trying to SEO a wordpress blog for the first time. I noticed that the site had links to certain parts of the blog outside of wordpress, but used a slightly different URL, which in the eyes of Google et al is a completely different URL. Read the rest of this entry »

Read Wordpress RSS Feeds, YouTube Video Lists, and more…

April 16th, 2008

I needed to grab a couple of new blog entries on a website’s wordpress blog area, and put it on a non-wordpress home page. I ended up making a PHP 5 class that did the job for me. Very simple, no fancy stuff.

I then needed to get a load of youtube video posts on the same site from a specific account and had to make a list of that, with thumbnails etc. . I ended up tweaking the first class ever so slightly and lucky me, I had an easy feed reader.

Read the rest of this entry »

Virtual PC for browser checking and more…

April 4th, 2008

I was a little short of extra computers for browser testing recently (RIP PCs) and so I gave Virtual PC a try. Installing XP on my Vista Installation is dead easy, and admittedly does save me some space on my desk when browser testing. The fact that Microsoft gives it for free is an interesting one….

Rather than explain how it works or give some instructions, I will make it brief and pass on some links I found useful to sites that do the job perfectly well: Read the rest of this entry »

DOMDocument whitespace text nodes

March 31st, 2008

The DOMDocument is a convenient way of manipulating an XML file. One issue I ran into was the fact that when loading an XML file, DOMDocument treats the tabs and spaces which make the XML readable as empty text nodes. This presents a problem when you try and traverse the DOM by using attributes like firstChild and nextChild. For example:

Here is the XML file, “example.xml”:

    Value

Read the rest of this entry »

Son of a Son of Suckerfish!

March 20th, 2008

I’ve been using the lovely Son of Suckerfish method to make drop down menus for years now, and it is a very robust way to make them. The one criticism (the word criticism is an overstatement really…) I have is that for every sub-menu level, you need to add to the CSS in order for that to show. Now, it’s not a really big inconvenience… how many sub-levels do you need anyway… but wouldn’t it be nice if we didn’t have to do that? I have made a very small change to the CSS and Javascript that takes care of this problem. Read the rest of this entry »

What’s your age? PHP can tell you

March 7th, 2008

I was looking around for a simple function or something that calculates the age of a person with a given date. I figured there must be something that did this natively in PHP, but to my surprise…. no.

Further looking around found some overly complicated (not “complicated” but just way too long for what they do) scripts to calculate an age. In the spirit of easy minimal code, I did it in two lines :

1
2
$ageTimestamp = time() - strtotime($date);
$age = floor($ageTimestamp/60/60/24/365);

So…. quick explanation for those that are learning the ropes …. Read the rest of this entry »

jscalendar 1.0 aqua theme incompatability fix for Konqueror

March 3rd, 2008

I love jscalendar… it’s dead easy to use, does what I want, is very flexible, and looks nice. Anyone that has a better free option, please let me know. MooTools (along with other JS libraries) have some cool implementations, but this script does stuff that others do not do.

When IE7 came out there was a bug in the calendar which essentially rendered the free version useless and therfore had me thinking of alternatives. Thankfully, this was soon resolved and I have been using jscalendar to this day.

A problem I came accross today is that the very cool aqua CSS theme that comes with the calendar didn’t work properly on KDE’s Konqueror. Read the rest of this entry »

Session variables not set on following page after header() redirect

February 27th, 2008

The main reason for this blog here is to share with others the problems I’ve encountered and solved in the hope of saving someone banging their heads on the wall trying to solve issues that are sometimes trivial but waste stupid amounts of time.

A problem I recently encountered is that after doing some PHP magic and then redirecting a user to another page, the following page loses all the session information set in the previous page. For hours I was there trying to figure out why this was happening, and hopelessly trawling the net for answers!

Read the rest of this entry »