Posts under Tag: gotcha
Using path conditions with Hash::extract() in CakePHP 2

The CakePHP book page on the new Hash class, the replacement for Set, is not exactly extensive. There’s even an error: the arguments for Hash::extract are $data, $path, but the example given uses $path, $data (the former is correct). One aspect of Hash that the book is particularly quiet on is how to use path conditions with methods such as [...]

By Jamie with 1 comment
‘form’ a reserved word for CakePHP 1.2 controller params – watch out!

THIS CONTENT IS OUT OF DATE! IF YOU’RE USING CAKE 2, YOU SHOULDN’T READ THIS. Just a quick bit of advice to those who may have been banging their heads against the walls when trying to pass “form” as a custom parameter in a CakePHP URL. Apparently ‘form’ is a param – an array, to be specific – that’s already [...]

By Jamie with 0 comments
Custom Prefixes and Named URL Arguments – CakePHP Gotcha

THIS CONTENT IS OUT OF DATE! IF YOU’RE USING CAKE 2, YOU SHOULDN’T READ THIS. Apparently custom prefixes and custom named arguments in URLs don’t mix all that well in good ol’ CakePHP. I’ve got a StatisticsController with some custom_-prefixed actions. So, in routes.php I added this line to parse the URLs: Router::connect('/statistics/custom/:action/*', array('prefix' => 'custom', 'controller' => 'statistics', 'custom' [...]

By Jamie with 0 comments
Quick Gotcha with HTML Forms, Image Inputs, and Internet Explorer

Watch out when using ‘image’ input types, since the $_REQUEST variables you get vary depending on the user’s browser. Let’s say you’ve got this input field: <input type="image" src="go.png" value="go" name="pagination_submit" /> In Firefox (and I assume most other logical browsers) you’ll get three $_REQUEST variables from this input: ‘pagination_submit’, ‘pagination_submit_x’, and ‘pagination_submit_y’, where the latter two correspond to the [...]

By Jamie with 0 comments