Zend Framework: partial() and render()

partial() will render a view script, and render() will render a view script. So… which one do I have to use?

All depends on the variable scope.

Render()

The render() function will render the given view script within the variable scope of the script is was called from.

$this->render('script.phtml');

Partial()

partial() will also render the given view script, but you can define a special variable scope: you can pass all requested parameters in an array.

$this->partial('script.phtml', array('var1' => 'value 1', 'var2' => 'value 2'));

This can be very useful to use a view script in a loop.

Ignore option in Zend_Translate

My project is under version control with SVN. Although SVN is very usefull, it generates a lot of files, and sometimes this makes the performance bad.

Take for instance Zend_Translate. I use Qt to handle all translations. Qt will scan a given directory for all translation files, and so it will also scan all .svn directories.

resources.translate.data = APPLICATION_PATH "/locale"
resources.translate.adapter = Qt
resources.translate.options.scan = directory

While debugging my application, I discovered a very useful option to ignore all .svn directories:

resources.translate.options.ignore = ".svn"

Very useful option.
Off course it is possible to add more directories or files to ignore.

UPnP on NAS finally works

UPnP logoAfter 6 months, I got the UPnP network media streamer on my NAS (D-Link DNS-323) finally working.

The problem was that none of my media files was accessible on the network over UPnP. I could easily find the files with a file browser, but none of my UPnP clients detected any files.

Finally D-Link released a new firmware upgrade to version 1.08 with two fixes for the UPnP server:

  • UPnP AV can handle long file names and in file names with spaces
  • UPnP AV server will skip corrupted file instead of stopping the scan process

Now I can see where the problem was. Most of my media files have spaces in their names.

Good job for D-Link that it’s fixed now, but still a little too late…