Returning from a template
July 25th, 2011Ever needed to return from a template earlier than at its end? Exit in the middle or even at the very beginning because you don’t want to print the rest of the template?
Read the rest of this entry »
Ever needed to return from a template earlier than at its end? Exit in the middle or even at the very beginning because you don’t want to print the rest of the template?
Read the rest of this entry »
Ever needed to call the same function with different number of parameters? Easy right, just use default values:
But what if you want to make the first parameter optional?
Here’s a simple technique for doing so it in a transparent way.
Read the rest of this entry »
Nette documentation doesn’t provide details about methods execution order in case of a submitted form. So hear hear, it is this:
I’ve had some troubles with a page that refused to be wrapped in a layout. It turned out I accidentally erased {block #content} in my presenter template. Read on for the background logic explanation.
Read the rest of this entry »
We have shuffle() to reorder a numeric array, we have array_rand() to randomly pick a specific number of values from an array but there’s no built-in command for shuffling an associative array. After having seen a few pretty bad solutions I decided to offer my own.