| 20/05/2010, 12:55 PHP Mode for emacs on Mac OS X

It's been a long time since I figured this out and I can't remember what resource I used to help me. Anyway to get PHP Mode working with the native emacs bundled with Mac OS X do the following:

$ mkdir elisp; cd elisp
$ wget http://bit.ly/cLqD47

Then edit/create the file '~/.emacs and put in the following:

(add-to-list 'load-path "~/elisp")
(load "php-mode")
(add-to-list 'auto-mode-alist
	     '("\\.php[34]?\\'\\|\\.phtml\\'" . php-mode))

Et voila, you will now have lovely syntax highlighting and auto indenting when editing your PHP files. (NB: The bit.ly link points to the php-mode.el script hosted on Sourceforge.)

| 21/04/2010, 13:24 Name of current module controller or action from Yii view

I've been using Yii framework a fair bit recently and it seems very nice so far.  However I couldn't easily find out how to get hold of these often essential pieces of information from a Yii view.  Useful in situations where you want to build a navigation user interface element etc. This is all you need to know...  

// Module
if(isset($this->module)): echo $this->module->getName(); endif;

// Controller
echo $this->ID;

// Action
echo $this->action->id;

| 01/01/2010, 19:35 MVC

Welcome to the first live site to use the latest version of my own MVC (for use with Smarty) that is now successfully running on top of PHP 5.3.  Recent work on it has been a fun ride, driven mostly out of a desire to have controller classes whose names do not clash with those of auto-generated classes from PHP Doctrine. i.e. they would potentially still clash if it wasn't for namespaces :0]

Admittedly this wouldn't be such a large issue if the MVC supprorted internal URL re-routing but it doesn't.  This is due to a semi-conscious awareness that controllers should be thin, refactoring them never a big deal and because mod_rewrite is your friend. Anyway I'm hoping to finally get a release candidate for version 1 of the code up on GitHub over the next few weeks. Pretty nervous about any response I might get.

| 02/09/2009, 13:28 Running a Symfony application from a directory

Step 1 - Install Symfony into your PHP library path:

# cd /usr/share/php
# wget http://www.symfony-project.org/get/symfony-stable.tgz
# gunzip symfony-stable.tgz ; tar -xvf symfony-stable.tar
# ln -s symfony-X/lib symfony
# mkdir data
# ln -s ../symfony-X/data data/symfony
# rm syfony-stable.tar

Step 2 - Within your Symfony app, edit the main 'settings.yml' file, create a symlink to 'sf' and ensure the cache directory is writable:

$ cd /var/www/localhost/htdocs/sf_app
$ echo "all:" >> config/settings.yml
$ echo " .settings" >> config/settings.yml
$ echo " relative_url_root: /sf_app/web" >> config/settings.yml
$ ln -s /usr/share/php/data/symfony/web/sf .
$ chmod -R 777 cache

And you're done.