Thursday, November 15, 2012
Disabling translator for Zend_Form_Element
If you use Zend_Form and also Zend_Translate, core Zend functionality tries to translate options of Zend_Form_Element_Select or any other options of elemenet inherited from Zend_Form_Element_Multi. This is not needed in all cases. To disable translator on the element just call function setDisableTranslator like this:
$element = new Zend_Form_Element_Select('my_element');
$element
->setDisableTranslator(true)
Wednesday, November 7, 2012
Recursively walk through directory tree
If you need to get all files (or also folders) from some folder and it's subfolders recursively, use following simple construction:
http://php.net/manual/en/class.recursiveiteratoriterator.php
http://php.net/manual/en/class.recursivedirectoryiterator.php
http://php.net/manual/en/class.splfileinfo.php
$folder = '/path/to/folder'; $objects = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($folder), RecursiveIteratorIterator::SELF_FIRST); foreach ($objects as $object) { /** * $object is instance of SplFileInfo */ if ($object->isFile()) { echo $object->getExtension(); echo $object->getRealPath(); } }Check also PHP manual
http://php.net/manual/en/class.recursiveiteratoriterator.php
http://php.net/manual/en/class.recursivedirectoryiterator.php
http://php.net/manual/en/class.splfileinfo.php
Tuesday, November 6, 2012
How to install PhpStorm on Ubuntu 12.10
If you want to try or use great php IDE PhpStorm follow these steps:
- download PhpStorm from http://www.jetbrains.com/phpstorm/download/
- unpack downloaded file with following command tar xfz PhpStorm-*.tar.gz (or right click in nautilus and choose "Extract Here")
- open folder "PhpStorm/bin/", right click to "phpstorm.sh", choose "properties. In permissions tab mark checkbox "Allow executing file as program"
- install Oracle JDK by following commands:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
- double click on file "phpstorm.sh", click to "run"
Subscribe to:
Posts (Atom)