b05q's blog

Nov
05

the hype machine - the coolest drupal site ever!

The Hype Machine is a huge aggregation of music blogs. sooooooooooo much music. it's like radio, with the option for download, featuring more pre-release/rare goodness than you will ever manage to listen to.

tagged as
Nov
04

drupal tip: save time with a js/css dropdown menu

i strongly recommend using a javascript/css drop-down menu to replace the standard issue naviagtion module. it's a compelte waste of time to sit there wait/click through 3 pages (e.g. 'Administer', 'Logs', 'Status Report'), when you know exactly where you want to go. With a drop-down menu, you just click 'Status Report'.

tagged as
Nov
03

drupal how to: make a custom block that processes url arguments

I needed a block in the right sidebar that displayed the user's name, picture and profile_bio (a multi-line text field i added to the profile). There's a block provided by the profile module that will do that already, but unfortunately it's hardcoded to only show itself in pages like node/*. I needed it to show in pages listing all the nodes of a particular site that a user has created, e.g. blog/*, as well. I used the views module to do it, here's how (you'll need the profile and blog modules from the core, and the views module to do this:
tagged as
Nov
02

useful db functions for drupal

Anytime you pass variables to your database, you need to escape them (tell the db that 'this is data and not code'). This protects you from cross-site scripting. Drupal is no different. but fortunately it's easy. check it out.


for example, instead of this:

db_query("SELECT COUNT(*) FROM {node} WHERE type = ".$type." AND status = 1")



you would want to use something like this:

db_query('SELECT COUNT(*) FROM {node} WHERE type = %s AND status = 1', $type)


tagged as