Code Snippets


<?php
/*
* The script will print "Mar"
* See php.net/date for more formatting options
*/
$m = 3
print date('M', mktime(0,0,0,$m,1,date("Y")));
?>

$state_list = array('AL'=>"Alabama",
'AK'=>"Alaska",
'AZ'=>"Arizona",
'AR'=>"Arkansas",
'CA'=>"California",
'CO'=>"Colorado",
'CT'=>"Connecticut",
'DE'=>"Delaware",
'DC'=>"District Of Columbia",
'FL'=>"Florida",
'GA'=>"Georgia",
'HI'=>"Hawaii",
'ID'=>"Idaho",
'IL'=>"Illinois",
'IN'=>"Indiana",
'IA'=>"Iowa",

Here's a cool trick, drop this code in your views display header to show how many rows were returned by the query (be sure to use the PHP code input format):

There are currently <?php
$view = views_get_current_view();
echo $view->total_rows; ?> records displayed.

I imagine that the views_get_current_view() function can come in handy for other purposes.

This is just a handy place to write this down, I don't expect it to be useful to anybody else. I messed up a Drupal installation by extracting the Drupal base install archive in my sites/all/modules directory. My site then thought it was the wrong version of Drupal. Just removing the offending folder broke the site as Drupal couldn't find it's system and other important modules. These are the SQL queries that pointed Drupal back in the right direction.


/*
* first, remove the messed up rows from the system table on the DB:
*/


<?php
echo "Hello, world!";
?>