Pages

Monday, October 21, 2013

PHP abstract classes

  • Abstract classes cannot be instantiated
  • A class must be declared as abstract if any of its method is abstract
  • Methods defined as abstract must only declare its signature
  • When inheriting from abstract class the child must define all the abstract methods with the same visibility or lower
  • The type and arguments must match the signature

Installing Zend Framework 2 Skeleton Application in Ubuntu

  1. Go to https://github.com/zendframework/ZendSkeletonApplication and click the “Zip” button
  2. This will download a file with a name like ZendSkeletonApplication-master.zip
  3. Unzip this file into the directory and rename it to something like 'skeleton'
  4. Navigate into this folder and run the composer.phar as described below
  5. 
    cd skeleton
    php composer.phar self-update
    php composer.phar install
    
    
  6. This installs ZF2 in the vendor/zendframework/zendframework folder

Friday, October 11, 2013

Enabling clean url via .htaccess in drupal 7

Sometimes due to server settings the clean url test may fail. To fix this make sure to add the below lines in .htacess file in the drupal root folder.


# Pass all requests not referring directly to files in the filesystem to
# index.php. Clean URLs are handled in drupal_environment_initialize().
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ /client/delacon/devel/index.php [L]

Thursday, October 3, 2013

Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed'

You have to cast the XML data to a string because internally they are all SimpleXMLElement


$event['mov'][$y]['name'] = (string)$child->name;
$event['mov'][$y]['movie_id'] = (string)$child->venues->venue->attributes()->id;
$event['mov'][$y]['description'] = (string)$child->description;