Jake Rathmanner
jake@creatogether.com
(+43) 676 445 69 99
Dan Borufka
dan@creatogether.com
(+1) 415 310 8264
13.03.2011

Run PHP functions via GET

Working on a side-project we needed PHP functions to be called using the URL query – or, technically speaking, the first key of the $_GET variable.
Simply put, we created a tiny script that would look for a function named after your request within script and run it. Example:

http://www.creatogether.com/example_exec.php?askSomeone(“jake”)

would run the function askSomeone of example_exec.php.

// EDIT: We changed the script to support parentheses (, ) and equal signs = inside the call

. the script!
Read the rest of this entry »

08.04.2010

Custom Snippets in WordPress

Writing your own blog, you sure are familiar with the occasional situation of having little snippets of code or text you need over and over again. We show you how to create snippets for WordPress which will make your life easier. Read the rest of this entry »

19.02.2010

Before/After Script

Before
After

To emphasize the difference between our raw material and the final results we were using a jQuery plugin called ‘beforeafter’. As the nerds amongst you might have already noticed, we just switched to a more sophisticated solution. The main issue with jQuery.beforeafter is that it is styled with absolute positions, which destroys the whole structure when the user resizes his browser after having loaded the page. Read the rest of this entry »

07.02.2010

IE and jQuery

A little time saver hint: Internet Explorer 8′s JavaScript engine seems to interpret associative arrays (in this case objects) different than others (tested in Firefox 2, 3 and 3.5, Opera and Safari).
While other browser’s JS engines interpret the following as just fine –

    $('div.panel').css( { color : '#C00', width : '238px' } );

– IE will stop executing the JavaScript. What the issue is? The issue is that Internet Explorer looks for the variables color and width. As we never declared them inside of our JS, he will have a hard time finding anything that might match. To work around this problem, just put the properties in quotes:

    $('div.panel').css( { 'color' : '#C00', 'width' : '238px' } );

Dan Borufka

19.01.2010

IE PNG-Bug

Admitted, it’s not breaking news that Microsoft Internet Explorer has had his issues displaying PNGs. I wasted another hour on fixing an IE bug just recently and stumbled across a phenomenon I’d like to share – it might spare somebody a lot of time.
In my example, I filled some <DIV>-tags with a background-image PNG file containing a 1×1 pixels black with an opacity of 60%. The background-image was set to be tiled via CSS and all Safari, Opera, Firefox 2, 3 and 3.5 displayed it correctly. Internet Explorer 8 on the other hand was on his funky company manners and showed some fancy gradients:

#title_bg{
	background:transparent url('../imgs/title_bg_62.png');
	width:200px;
	height:60px;
}

IE PNG bugHow comes? Well, looking at the problem from Internet Explorer’s point of angle, simple Math leads us to the solution. Our PNG measures 1 by 1 pixels, let’s say our <DIV> is 200×100. Having the background-image being set to be tiled, IE has to calculate 1 x 1 x 200 x 100 = 20.000 pixels (It doesn’t shock me at all IE turns out to be the only browser incapable of handling such an operation).

The workaround is pretty simple: releave your browser of three quarters of the calculation tasks by raising the PNG size to 2×2 pixels.

Jake & Dan

18.01.2010

PHP Snippet: building plurals

I recently coded a handy little PHP function to return a grammatically correct sentence building its plurals depending on a passed numerical parameter and different flexions of the word separated by slashes. If you need other HTML tags than breaks inside the strings you will have to alter it, but other than that it supports <br />s.
See the example to get a picture:

<?PHP

getPlurals("There is/are still one/two/three/four slot/slots open.", 3);
// returns: There are still three slots open.

getPlurals("There is/are still one/two/three/four slot/slots open.", 1);
// returns: There is still one slot open.

getPlurals("There is/are still one/two/three/four slot/slots open.", 2);
// returns: There are still two slots open.

?>

Read the rest of this entry »