we love web standards, css, html, actionscript, php, javascript, accesibility and usability

Joomla! 1.5 Find Section Name PHP Function

May 1st, 2009 Jonathan Harriot expand/collapse this entry

On a recent project I was forced into using Joomla! 1.5. Joomla! is nothing to be excited about unless you like a bloated, non-user friendly CMS which has to my knowledge no clean code. Thank God for WordPress, but I digress.

I prefer to use server side code to display static elements such as a Flash object or video playlists for the homepage but to accomplish this with Joomla requires the user to create a module and blah blah blah.

For brevity’s sake I created a simple function to evaluate the current page’s section name

The Function:

function sectionName($pName) {
	if (JRequest::getVar('view') == $pName)
		return true;
	else
		return false;
}

Sample Usage:


if (sectionName(frontpage)) {
	echo ("You are home");
}

Although Joomla is the anti-Christ of Content Management Systems you can make it work for you in bits & pieces.

Google Talk and WinAmp Issue Resolved!

January 23rd, 2009 Jonathan Harriot expand/collapse this entry

So there’s this wonderful problem that came about with WinAmp and Google Talk. If you try to “Show current music track” in Google Talk while WinAmp is playing some music it will have a cardiac arrest, freeze up and force to CTRL+ALT+DEL it into oblivion. I tried logging into Google Talk via Gmail to change the status message to something else or even opening iTunes (which works wonderfully with Google Talk I would like to add!) just to get Google Talk to stop freezing up. I searched the internets and found some advice around forums and here is what I found that worked for me in less steps than were posted on almost all the forums:

Option 1:

  1. Close Winamp and Google Talk (also any other music player type programs)
  2. Download and run the following file: WinAmp_GoogleTalk_Fix.bat
  3. You’re Done! (hopefully)

Option 2:

  1. Close Winamp and Google Talk (also any other music player type programs)
  2. Go to the Start Menu (bottom left corner of your screen), click on “Run” and paste in the following: C:\Program Files\Winamp\ then hit Enter or click “Ok”
  3. A new window will open and inside of this new window select “File” then “New” then “Text Document”
  4. Change the new text document’s name to “winamp.m3u” and re-open Winamp and Google Talk

Hope this was helpful, cheers!

Slide N’ Hide jQuery Navigation Accordion Slider

November 12th, 2008 Jonathan Harriot expand/collapse this entry

View Example
View Source Code

A simple vertical jQuery accordion with much room for growth. In future version I would like to use a few additional lines of JS to create a cleaner structure but even if only as an example this is a good start. I made a horizontal accordion as well but all things will be made public in due time.

This script creates a cooking and remembers which section was last opened therefore making it a great homepage piece or miniature site navigation.

Cheers!

Firefox 3 Closes All Open Tabs on Exit Problem and Forgets To Ask What You Wanted

November 12th, 2008 Jonathan Harriot expand/collapse this entry

Firefox is a priceless debugging tool for web developers. However, when it stops functioning properly, daily tasks & work become more complicated.

One day Firefox stopped asking if I wanted to restore my tabs when the program closed. After being annoyed for quite sometime I thought about restoring FireFox to its defaults settings.

Windows XP/2000/Vista:

firefox -safe-mode

“C:\Program Files\Mozilla Firefox\firefox.exe” -safe-mode

OR

Start > All Programs > Mozilla Firefox (folder) > Mozilla Firefox Safe Mode

Linux:

/path/to/firefox/firefox -safe-mode

Mac OS X:

/Applications/Firefox.app/Contents/MacOS/firefox -safe-mode

Now, while it is true that somewhere along the way I may have inadvertently unchecked “No, don’t ask me again” the problem was nonetheless frustrating. So, if Firefox does not remember what tabs you had open before on closing it just follow those steps above.

That is unless you don’t want it to remember what tabs were open, browsing history, passwords, cookies, etc because you were looking at skeevy porn or browsing the Jars of Clay ‘Eternal Fanclub of best Friends Forever’, then you probably shouldn’t be using Firefox. Use Internet Explorer and get the viruses God intended your computer be infected with.

Flickr + PHP + XML + Flash = Fun

November 12th, 2008 Jonathan Harriot expand/collapse this entry

PHPFlickr is a really neat little package that makes implementation of Flickr’s API quick and painless. I tried various techniques to create a slideshow for a client with LyteBox to enlarge the images but I slowly grew tired of the animation and the functionality that almost no one for this specific project would use. So I grabbed a small SWF slideshow from my toolbox and went to work creating a simple script to grab the photos and output the image URI I needed without creating bulky code. Here is what I came up with to make this easier for myself:

<?
photosets_getPhotos($photoset_id, NULL, NULL, 15, 1);

	// create a random interval for the timer between 6 and 10 seconds
	$randomnumber= rand(6,10);

	// create an array to output as xml
	$xml_output = "\n";
	foreach ((array)$photos['photo'] as $photo) {
		$xml_output .= "buildPhotoURL($photo, "medium") . "\" ";
		$xml_output .= "/>\n";
		$i++;
	}
	$xml_output .= "\n";
	echo $xml_output;

	// you're done!
?>

Simple and straight forward.

Featured: Amies Updated Reel

November 12th, 2008 Jonathan Harriot expand/collapse this entry

A few of the projects I had the pleasure of working on at Amies have been featured in their newest reel. The video was created by Travis Anderson and is pretty solid as a whole. Enjoy!

It’s Just A Font

February 25th, 2008 Jonathan Harriot expand/collapse this entry

Banksy Desktop Backgrounds

January 31st, 2008 Jonathan Harriot expand/collapse this entry

Banksy Desktop 1

 

Banksy Desktop 2

 

Banksy Desktop 3

 

Banksy Desktop 4

 

Banksy Desktop 5

 

Banksy Desktop 6

 

Banksy Desktop 7

download them all or download the originals

I was really bored tonight and decided to revamp my background selections. So bored with work. So incredibly bored…

PHP Image Watermarking

January 28th, 2008 Jonathan Harriot expand/collapse this entry

I had to build this for a client rather swiftly but here is the brass tax of the matter. My client requested that every image in a section would be automatically water marked. I read a few good articles and played around a bit before creating this based on the others I had been reading about.

Criteria:

  1. Auto centered mark
  2. semi transparency
  3. works with 24-bit .png files for image watermark
  4. Must work on the fly
  5. must be able to watermark png/jpeg file types
  6. due Monday by noon :P

That being said I produced the following based on notes I took from various sites:

<?php
// example url
watermark.php?i=display.php?show=23
$imageUrl = $_GET['i'];
$watermarkUrl = "watermark.png";
$orgimage=imagecreatefromjpeg("{$imageUrl}");
$watermark=imagecreatefrompng("{$watermarkUrl}");
$watermarkDetails=getimagesize("{$watermarkUrl}");
$imageDetails = getimagesize("{$imageUrl}");
$centerx = (($imageDetails[0] - $watermarkDetails[0])/2);
$centery = (($imageDetails[1] - $watermarkDetails[1])/2);
imagecopy($orgimage,$watermark,$centerx,$centery,0,0,
imagesx($watermark),imagesy($watermark));
header("Content-Type: image/jpeg");
imagejpeg($orgimage);
imagedestroy($watermark);
imagedestroy($orgimage);
exit;
?>

Del Taco’s AllNightLongBaby.com Database Fun!

December 16th, 2007 Jonathan Harriot expand/collapse this entry

I was cruising around Del Taco’s website, scouring up and down for coupons other than Free Macho Drink or Big Fat Breakfast taco (Buy 1 get 1 Free) I found a small exploit in their admin tool, you can’t write to the database but you have read access:
http://shared.sprokkit.com/admin/?task=display&object_type=slist&object_id=252 (here’s a backup link in case Del Taco or Sprokkit catches this error after appearing on Dig

Del Taco has a minisite to promote their “All Night / 24 hour a day / It’s 3am, I’m drunk and need to sober up” Fast Mex grub (allnightlongbaby.com/). where users submit how they define the difference between a “late night” and “all night”. These are their responses with the approved AND rejected submissions.

Samples:

Order 1219
Late Night Text Red Bull
All Night Text Cocaine
Approval Status Rejected
Order 1263
Late Night Text a head ache
All Night Text a butt ache
Approval Status Rejected
Order 1307
Late Night Text wondering where you left your coat
All Night Text wondering where you left your underwear
Approval Status Rejected
Order 1366
Late Night Text breaking her bed
All Night Text staining her walls
   
Approval Status Rejected
Late Night Text a donkey
All Night Text a donkey punch
Approval Status Rejected

Brought to you by someone with a love for Del Taco who went on a hunt only for Del Taco Coupons but found much more. Cheers!

UPDATE: Del Taco’s director of marketing just sent me an email, the jig is up, but they were very kind about the whole thing. Thanks for having a sense of humor!

« Previous Entries