7 Things – Tagged by Thijs Feryn

Geplaatst in Blogging Reeds 2 reacties

Well I guess nobody can escape the 7 things chain? I got tagged by Thijs yesterday and now it’s my turn to come up with 7 things you might or might not know about me …

7 Things

  • I have no degree, I only finished high-school (Social Sciences) and attended one year of College before dropping out and started working
  • I’m completely self taught, autodidact if you wish
  • I love to cook and according to my girlfriend am quite good at it. I learned most of it during high-school where we had cooking classes 4 hours per week. Then it sucked, now I love it!
  • I’m a metal fan. In Flames, Opeth, Amorphis and Moonspell are among my favourite bands. Older metal bands like Manowar, AC/DC, Blind Guardian, Iron Maiden and Gamma Ray are on my playlist too. As long as it has a good melody in it I like it.
  • I’ve spent my high-school time at a boarding school. I hated it when my parents sent me off to a boarding school but looking back at that time I must admit that it probably was the best decision my parents ever made for me. It’s there that I met my girlfriend in 6th grade.
  • I live in a city called Peer which translates into english as pear which is quite amusing seeing my affinity with PHP (you php developers know what I’m talking about)
  • During my career I’ve worked as waiter in a restaurant, assembly-worker at a truck parts factory, maintenance technician at the Ford factory in Genk, clerk in a bookstore and even garbage collector. So I’ve had my share of stupid jobs before I finally got the opportunity to start as web-developer.

Seven People

This is going to be the hardest part, finding 7 people to tag … most people I know either don’t blog or already are tagged so i’ll do my best coming up with 7 …

  • Jente Kasprowski for he is the single most talented webdesigner I’ve met, has a great musical taste, is the best boss you could ever wish for and really has to start his own personal blog! http://www.inventis.be (Yes Jan, you are nice too but Thijs already tagged you :p )
  • Niki dubois, for he is the guy that got me blogging again, my newest colleague at Inventis and all-round nice guy: http://blog.ikin.be/
  • Bart Vandebeek for he is a nice colleague, great designer and fun guy. And he has to keep his damn blog up to date: http://www.studioimago.be/blog/
  • Mark Creeten, for he is a fellow with a big passion for webdesign, and autodidact like me and for the chats we had when I was still working at Boek & Soft: http://www.gigadesign.be/

Well there we have it … the rest of the people I would like to tag are already tagged (thijs, andries, felix, michelangelo, skoop, …) or don’t blog (iworx, david, dirk, dieter, … do something about it guys, there’s more than twitter alone :) )

Here are the rules for my fellow bloggers who I tagged:

  • Link your original tagger(s), and list these rules on your blog.
  • Share seven facts about yourself in the post – some random, some weird.
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.

Admin CMS routes in Zend Framework

Geplaatst in PHP, Webdevelopment, Zend Framework Reeds 11 reacties

For some time now I’ve been pondering on how to implement a CMS in the websites I build using Zend Framework, there are several options available around the internet. Here I’m going to explain how I solved this issue and why this is my preferred way of working.

No custom routing for me sir

One of the solutions I found involved creating a separate module for each part of your website that requires administration (eg: news, blog, products, …). Then you can easily access the admin for each module. For example to access the news admin you would point your browser to domain.com/news/admin.

At this point this solution has one drawback and that is the URL structure, while for some people this doesn’t really pose a problem, I always like to have the part that identifies the CMS as first part of my URL. domain.com/admin/news instead of domain.com/news/admin. You could however solve this by creating some routes, but I still didn’t feel happy about this solution.

While this might be a good solution when you are building a CMS with plug-and-play modules where all code is contained in one module, this solution wasn’t really what I was looking for. I would rather have all my CMS code close together, preferable in a separate environment from my front-end website.

Modules

The solution I found most suited and flexible to use was creating a separate module for both the front-end and the back-end. This allows you to separate your business code from the CMS from your front-end while still being able to use common models for data access and manipulation.

The automatically registered Zend_Controller_Router_Route_Module route takes care of routing the request to the appropriate module or to the default module if no module has been specified.

My directory layout looks something like this.

Admin module directory Layout

You are ofcourse free to use whatever layout works for you, the most important part is that you have at least a frontend and admin module.
You’ll also notice i’ve split up the public directory to separate the public assets for the admin and frontend modules, keeps everything nice and tidy.

Next up is configuring the Front Controller to use modules which is quite easy.

$frontController = Zend_Controller_Front::getInstance();
$frontController->addModuleDirectory(APP_PATH.'/modules');
$frontController->setDefaultModule('frontend');

In the code above we tell the Front Controller where to find the modules and which module to use when none has been specified in the request or when none is found. Pretty basic and it works!
Just put all your CMS specific controllers in the admin module, and all front-end controllers in the frontend module.

But wouldn’t it be nice if we could also separate our Zend_Layout’s, so we have a separate layout for our front-end and admin area’s and the files for these are contained in the respective module directories? This is where Controller plugins come in handy.

/**
 * Controller plugin that sets the correct paths to the Zend_Layout and
 * Zend_Controller_Plugin_errorHandler instances
 *
 * @package    Skyrocket_Plugin
 * @copyright  Copyright (c) 2005-2008 Skyrocket Concepts (http://www.skyrocket.be)
 */
class Skyrocket_Plugin_Adminsetup extends Zend_Controller_Plugin_Abstract
{
	public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
	{
		// Set the layout directory for the loaded module
		$layoutPath = APP_PATH . '/modules/' . $request->getModuleName() . '/layouts/scripts/';
		Zend_Layout::getMvcInstance()->setLayoutPath($layoutPath);

		// Configure the error plugin to use the loaded module
		// so we can use module-specific error handling
		$frontController = Zend_Controller_Front::getInstance();
		$errorPlugin     = $frontController->getPlugin('Zend_Controller_Plugin_ErrorHandler');
		$errorPlugin->setErrorHandlerModule($request->getModuleName());
	}

}

Create a class file like the one above and register the plugin instance with the Front Controller like this:

$frontController->registerPlugin(new Skyrocket_Plugin_Adminsetup());

The Adminsetup plugin intercepts the request before the Front Controller dispatches and modifies the Zend_Layout path to the current module’s Layout directory. It also registers a separate error handler for the admin module in case you want to handle your errors separately from your front-end errors.

What if I still want to use modules for my front-end?

I can hear some of you asking: But what if i’m building a huge website, with a huge amount of business logic? This is what modules really were made for but you are forcing me to use only one module for all my front-end controllers? Does this mean that I should stuff all the code for my forum in one gigantic controller in my frontend module?

No, not really, you still are free to use modules as you please. Feel free to create a forum module with a TopicController, ForumController, PostController and a CategoryController. These modules still work as expected and are accessible via domain.com/forum/topic

Conclusion

See, no funky routing configuration, no numerous admin controllers spead out over dozens of modules, all your admin controllers and layouts are nicely contained within one admin module and you are still able to separate all your code in individual modules or all into one frontend module. The choice is yours.

That’s it for now folks, any remarks, questions or do you think you are using a better method, feel free to comment.


Een wereld zonder Microsoft

Geplaatst in Every day life Nog geen reacties

Hoe zou een wereld zonder Microsoft eruit zien? Dat vraag ik me soms af … wat als ze Vista nooit hadden uitgebracht, of wat als Vista nu eens alles zou doen zonder problemen en bugs? Wat als al hun software bugvrij was?

Het zou slechter zijn denk ik zo … zonder Microsoft kan ik het vergeten dat ik per dag een keer of 5 achterover mag leunen terwijl ik een paar MB aan files aan het kopieëren ben, of als ik Vista moet rebooten, of tijdens het sharen van een map over het netwerk. Allemaal welkome rustpauzes tijdens een gemiddelde werkdag die er niet zouden zijn zonder Microsoft.

Ik wil niet weten hoe de gemiddelde kantoorklerk er zou uitzien moest hij een jaar lang de hele dag aan maximale productiviteit werken? Ik denk dat het (zelf)moord percentage de lucht in zou shieten.

Ps: ik hoop dat je beseft dat het sarcasme van deze blogpost afdruipt :)


Overschakelen op ubuntu

Geplaatst in Applicaties, Webdevelopment Reeds 3 reacties

Terwijl Jan de overschakeling naar Mac aan het doen is heb ik thuis de beslissing genomen om op Linux, meer bepaald Ubuntu, over te schakelen.

Niet dat ik niet tevreden ben van Windows XP, er zijn de kleine frustraties van windows maar in vergelijking met Vista ben ik nog steeds zeer tevreden van XP. Maar linux lijkt me echter een zoveel betere omgeving om webontwikkeling in te doen dan Windows dus is de beslissing snel gemaakt. En extra kennis van linux is mooi meegenomen, ik kan mijn plan wel trekken via SSH maar vlot gaat toch anders, maar daar komt zeer binnekort verandering in dus :)

Installatie ging erg vlot, Ubuntu downloaden, op USB stick zetten en installeren is een kwestie van een kwartiertje werk. En alles werkt vlot, drivers worden herkend, netwerk en internet werken out of the box, wat wil je nog meer? Ontwikkeltools natuurlijk!

En daar komt Apt in het spel, eclipse installeren is een kwestie van de terminal open gooien en apt-get install eclipse uit te voeren en even later is eclipse klaar voor gebruik. Apt is zeker en vast de grootste meerwaarde voor Ubuntu. Daarna de Aptana plugin voor eclipse installeren en de IDE is klaar voor gebruik.

Een dev server installeren gaat even makkelijk, apt-get install apache2, daarna svn, php5, MySQL en phpmyadmin nog, een paar virtual servers aanmaken in apache en de ontwikkelomgeving is klaar.

Nu Zend framework nog downloaden en we kunnen beginnen!

Linux, i’m starting to love it :)


Een jaar later … zucht

Geplaatst in Every day life Nog geen reacties

Goh, hier zijn we weer na precies één jaar afwezigheid, en zoals gewoonlijk begint het in het begin van een nieuw jaar te kriebelen met goede voornemens.

Vorig jaar is er niet veel van in huis gekomen, nuja … dat was grotendeels aan het huis te wijten, we hebben ons uit de naad gewerkt om alles klaar te krijgen en een maand later dan voorzien (eind oktober) zijn we eindelijk verhuisd naar onze nieuwe woonst. Van alle goede voornemens die voor 2008 in het verschiet lagen is dus niet veel in huis gekomen (let op de woordspeling :p), buiten verhuizen en voor een leuke thuis voor onze Torn zorgen. In die opzichten zijn we dus meer dan geslaagd.

Wat de voornemens voor 2009 betreft? Ik ga voorzichtig zijn en geen voornemens maken, dan kom je niet bedrogen uit zeker?

Hoewel ik wel 1 belofte ga maken, en dat is dat ik terug wat meer ga bloggen, Niki heeft me terug aangestoken en ik ga er het beste van maken, regelmatig iets vertellen, of het nu de moeite waard is of niet.

Tot gauw in ieder geval!