The Hulme Ramblings of a web developer

4Dec/110

Fun with routes

So I haven't looked at my brother's website for a while, and decided with Christmas coming up it is about time I got a move on with the site and got it finished so I can pass it off as his Christmas present!

First thing I did was to get the static pages set up; involving simple controller and view creating which has already been covered.

Next on the list was to set up the news part of the site; which required creating the table, models and views.
While I was at it I created the admin menu page as well.

While creating the admin I came across the need to set up some custom routes. This actually stumped me for 10 mins or so, as all the examples I could find were for older versions of Zend Framework, and it seems that it has changed quite dramatically since then. I did find one website that was quite useful, but only for one of the comments that helped me work out what I need to do.

So for future reference, just like Kohana to add custom routes you need to edit the Bootstrap.php file, but your routes need to go inside a function "protected function _initRoute()". And an example of a custom route is:


$ctrl = Zend_Controller_Front::getInstance();
$router = $ctrl->getRouter();
$router->addRoute(
'addNews',
new Zend_Controller_Router_Route(
'/photo/news/add', array(
'controller' => 'photo',
'action' => 'addnews'
)
)
);

15Oct/110

Hello world!

Decided to start blogging about work I'm doing in my personal time; more so I can record what I am doing and what I have learnt than for entertainment to the WWW.

With my day to day job I am a heavy user of Kohana and WordPress. But it is about time I started to jump on the Zend Framework bandwagon.

My starting point is going to be jumping in at the deep end and building my brother a website complete with custom CMS to showcase his Photographs, with him being a keen photographer.

Today I started with the Quick Start GuideĀ http://framework.zend.com/manual/en/learning.quickstart.intro.html and I must admit, having used Kohana for over a year now, it does come across that Zend is trying to be complicated for the sake of it. Or it could just be a misleading quick start.

Anyway in the end I got it working with no real problems. I had to make note of one of the comments explaining how to set the Database to be MySQL rather than SQLITE.