Mobile Device Detection in PHP

function mobile_device_detect($iphone=true,$ipad=true,$android=true,$opera=true,$blackberry=true,
  $mobile_browser   = false; 
// set mobile browser as false till we can prove otherwise
  $user_agent       = $_SERVER['HTTP_USER_AGENT']; 
// get the user agent value - this should be cleaned to ensure no nefarious input gets executed
  $accept           = $_SERVER['HTTP_ACCEPT']; 
// get the content accept value - this should be cleaned to ensure no nefarious input gets executed

jQuery SlideShow - Short and Sweet

    $('#slides img:gt(0)').hide();
        $('#slides :first-child').fadeOut().next('img').fadeIn(1000).end().appendTo('#slides');

CSS Drop Shadow on Bottom Side Only

Whatever the value of the third value (the blur), set the fourth value (the spread) to the negative of it and voila! You have a bottom side only drop shadow with css.

-moz-box-shadow: 0 6px 4px -4px gray;
-webkit-box-shadow: 0 6px 4px -4px gray;
box-shadow: 0 6px 4px -4px gray;

See what I mean . . .

Content Archive with Previous / Next Article Links for Any Content Type

    $type = "news";
    $foundArticle = 0;
	$nextNewsArticleTitle = '';
	$prevNewsArticleTitle = '';
	$nextNewsReleaseLink = '';
	$prevNewsReleaseLink = '';
	$prevNewsReleasePath = '';
	$nid = '';
	$nodeLink = '';
    $result = db_query("SELECT type,created,title,nid FROM {node} WHERE type = '%s' ORDER BY created ASC", $type);
        while ($data = db_fetch_array($result)) 
            if($foundArticle == 1)	
                $nextNewsArticleTitle =  $data['title'];
				$nid = $data['nid'];
				$nodeLink = 'node/'.$nid;

Drupal 6 - Create a page.tpl for a View

Just found a cool trick . . .
You can create a template file to theme almost any aspect of views output. In your case you want to create a custom template for your page display.

On the view designer, click the Theme link in Basic Settings. You'll see some template file naming options depending on if you want to theme the whole view (e.g., views-view--example--page.tpl.php), each row (e.g., views-view-fields--example--page.tpl.php) and so on.

Copy the appropriate template you want to customize from /sites/all/modules/views/theme to your theme and customize as you wish.

Javascript Cookies Using jQuery Cookie Plugin

I chose to use the improved version of the jQuery Cookie Plugin with more functions as well as short/easy examples on how to use these functions.
(jQuery Cookie Project Page)

Ask For Confirmation When Leaving a Page

Ask for confirmation when leaving a page in javascript is useful when you have a multistep form or lengthy form that the user may expect to be saved. This code will execute whenever the page is about to be unloaded, to include clicking any links to a new page, using the forward/back buttons of the browser, and when using the address bar to go to a new site or page.

var warning = true;
window.onbeforeunload = function()
     if (warning) 
    return 'You have made changes on this page that you have not yet confirmed.

Prevent the Enter Key From Submitting a Form: javascript char codes (key codes)

This snippet will prevent the enter key being pressed from submitting a form or clicking the button that is in focus. Replace #foo with the id, class, or element.

Cross Browser Drop Shadows

-moz-box-shadow: 0px 6px 8px #111111;
-webkit-box-shadow: 0px 6px 8px #111111;
box-shadow: 0px 6px 8px #111111;
/* For IE 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4,Direction=135,Color='#222222')";
/* For IE 5.5 - 7 */
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4,Direction=135,Color='#222222');

The box-shadow property allows designers to easily implement multiple drop shadows (outer or inner) on box elements, specifying values for color, size, blur and offset.

Browser support is growing of late with Mozilla (Firefox

Syndicate content