Posts Tagged ‘tutorial’

Use Javascript to Parse a Query String

Tuesday, March 4th, 2008

Most server-side scripting languages, like PHP, come with built-in functionality for reading query strings. Javascript doesn’t have any kind of standard counterpart, but that doesn’t mean you can’t use query strings in Javascript.

With some String functions, you can create your own function to parse a query string attached to the request url and store it in an associative array – just like PHP would for you.
(more…)

Javascript Strings: How to Do String Replacement in JS

Friday, February 22nd, 2008

This morning I set about making a simple script to clean extra newline characters out of text. I could easily have processed the form contents in PHP, but I wanted to use Javascript to avoid reloading the page.

The concept seemed simple enough, but I ran into a problem – I didn’t know how to do string replacement in Javascript. The first thing I thought was, “What is the Javascript equivalent to str_replace?”
(more…)

RSS Feed: Building an RSS Data Feed in PHP with SimpleXML

Thursday, February 21st, 2008

RSS feeds are a must-have for modern websites. It’s easy enough to make an RSS feed of recent articles in PHP. But did you know an RSS feed can simply be information – not links to articles?

This article will look at how to build a basic feed of data – for our purposes, we’ll consider random quotes. It will also illustrate how to use SimpleXML to build the feed for us.
(more…)

How to Access XML Attributes in PHP Using SimpleXML

Friday, February 15th, 2008

A user on Programming Talk had a problem the other day. He was trying to build an XML parser to work with an xml data file (a character sheet from the WoW Armory).

His parser wasn’t working – because all of the information was stored in attributes instead of child elements. What’s the difference between the two? And how can we fix it?

Use SimpleXML.
(more…)

How to Create an RSS Feed for Your Site in PHP

Thursday, February 14th, 2008

Most blogging platforms come with built-in support for RSS feeds. Why? It’s a great way for users to keep up to date on your new content. Instead of loading up a dozen favorite sites, they can look at one feed reader and then decide what to pursue further.

So what if you don’t use a blogging platform or CMS that creates a feed for you? You can create one yourself in PHP. It’s pretty simple.
(more…)

New Script: PHP Length Conversion Class

Sunday, February 10th, 2008

I was looking for a project to tackle today, and I decided to make a script that would convert lengths from one unit or system to another.

It doesn’t sound all that complicated – and it’s not. I had a working script in a few minutes, but I didn’t like it. It had too many functions to do conversions for individual units. I wanted this script to be pretty well abstracted so that I could easily add new unit types – and so that the source code for the class would be very short.
(more…)

How to Modify a Wordpress RSS Feed Widget with Rel=Nofollow

Saturday, February 9th, 2008

I just added an RSS feed widget to my site (see the lower right corner – the DZone links). I frequent dZone a decent amount, and I find a lot of the articles interesting.

However, after some thought I became concerned that ten sitewide external links might be a bit of a drain on my pagerank. If only I could add “rel=nofollow” to all those links. But there’s no option in the RSS Widget to do that.
(more…)

How to Integrate an RSS Feed Into Your Site with Simple XML

Saturday, February 9th, 2008

Practically every site today has an RSS feed. Now, you could be like everyone else and simply use this as a way to read information as it’s published.

Or, you could use RSS for what’s intended for – content syndication. With Simple XML, it’s a piece of cake to use an RSS feed to add a list of links to relevant articles on your page.
(more…)

How to Create Multi-Page Forms in PHP, Revisited

Friday, February 8th, 2008

A couple weeks ago, I wrote a short article about how to create a multi-page form.

The simple solution I suggested involved a foreach loop that cycled through the $_POST array and sent every value along in a hidden input element. After a bit of reflection (and some useful comments), I realized there’s a teeny tiny security hole in that approach – so I’ve slightly modified it to close the loophole.
(more…)

Submit Graphics Tutorials to GimpTutorials.com for Traffic

Friday, February 1st, 2008

If you write tutorials on your website or blog, then niche tutorial directories are a great source of traffic. I list most of my php tutorials with good-tutorials and get a nice burst of traffic with each new listing.

Another site I’ve found useful is Gimp Tutorials. They’re a great place to list any graphics tutorials that you write for the GIMP graphic design program.
(more…)