Door Gauke Pieter Sietzema in Web development
Op 2 april 2009 | 1 reactie
Finally, a debug bar for Zend Framework: Scienta ZF Debug Bar. It’s easy to install and I’m loving it! All it takes to install is:
copy the scienta folder into your library
add some code to your bootstrap and include your database connection
run your app!
Get the debug bar here, including installation instructions.
...
Door Gauke Pieter Sietzema in Web development
Op 23 december 2008 | 2 reacties
I was working on an application which was using alot of number-formatting using Zend_Currency. I was using a view helper for this. The view helper looked like this:
class Sterc_Helper_ToEuro extends Zend_Controller_Action_Helper_Abstract {
public function direct($amount) {
require_once('Zend_Currency');
$currency = new Zend_Currency('nl_NL', 'EUR');
return $currency->toCurrency($amount);
}
}
There was a certain page which called this view helper about 10 times and the whole page took 12 seconds to load. I was initially looking at my MySQL queries, which caused some problems in this...
Door Gauke Pieter Sietzema in Web development
Op 5 december 2008 | 0 reacties
I was working on an application where I needed all unique brands from a mysql table to populate a HTML select box. I have no idea how to do that quickly with Zend_Table, so I found out you can just pass on your own SQL if you want.
A simple “SELECT DISTINCT brand FROM products ORDER BY brand ASC” will do in these cases. It would even be better if I had a seperate brands table, so I wouldn’t have this problem at all. But since this was a quick and dirty job, there was no brands table ;)
Anyway, these lines will do the job (where $db is an instance of your Db adapter):
$statement =...
Door Gauke Pieter Sietzema in Web development
Op 31 oktober 2008 | 0 reacties
Ik zat vandaag met het volgende probleem:
Er is een view helper (showMenu, te vinden in ‘/library/Sterc/View/Helper/ShowMenu.php’) die een menu genereert vanuit een database
In dat menu moeten url’s worden gegenereerd
Er was in het door mij gemaakte systeem echter al een manier om URL’s te genereren, namelijk een andere view helper (makeUrl)
Probleem: je kan niet even simpel $this->makeUrl() of iets dergelijks aanroepen
Oplossing:
In principe is een view helper gewoon een class. Een class kun je gewoon aanroepen en uitvoeren vanuit bijvoorbeeld de view helper...
Door Gauke Pieter Sietzema in Web development
Op 29 oktober 2008 | 0 reacties
Textmate is mijn meest gebruikte editor, sinds ik een Macbook heb. Sinds gisteren gebruik ik nu ook mijn zelfgemaakte theme. Je kan hem hier bekijken.
Het thema is geschikt voor PHP, HTML (met PHP) en JavaScript en zal ongetwijfeld worden gewijzigd om beter te werken met Zend Framework en jQuery, omdat ik dat dagelijks...