regular expressions

Del.icio.us Tag Filtering in PHP/Drupal

Filtering content through URI tagging was initially popularized by Del.icio.us and is now a common way to quickly navigate content. For instance, in a system that supports this type of navigation, you can constract a URL:

http://example.com/tag/drupal+news,rss

and get a vertical view of the domain data. In this markup, "+" stands for logical AND, whereas "," stands for logical OR.

Following is a PHP code snippet that processes "delicioused" query string into a logical expression (you can modify the code slightly and get an SQL where clause instead). In addition to the original del.icio.us syntax, it allows tags with spaces in them. You just need to enclose those in single or double quotation marks. For instance, the following expression is a valid one: http://example.com/tag/drupal+news,rss,'Steve Jobs'. Note: using quotation marks inside the tag names is still invalid syntax!

And following is the code sample:

Syndicate content