Loader

Namespacing standard.

A class named ClassFile is located in class/file

It can be :

class/file.php
or 
class/file/file.php

Respecting the namespacing means respecting the class name according to the file structure.



Joomla exceptions:

The generated component contains various exceptions.

  • Class is loading from 'classes' directory
  • Helper is loading from 'helpers' directory
  • MVC files are loaded from their respective client side (back / front)



Coding conventions

The class name is singularisated : Class prefix can search both in 'class' and 'classes' directories
So, never end class names parts with 's' or 'es'. The discoved method will cut it.

Example : ClassIris
will be renamed as ClassIri (without 's')
This will result a non working autoloading. Still you can load it manually.



Joomla issue (still in 3.2)

The namespacing is not working correctly in the discover function:

Even with 'recursive', a class located in class / file / upload will be registered as ClassUpload instead of ClassFileUpload.

Cook is offering an override to the Joomla loader and the discover function.

VERY IMPORTANT for Joomla 1.6
The component not will work anymore before you make this small change : Change private to protected

Or by alternative (not recomendated) :
Choose : Legacy loader in the builder advancer configuration of your component.

Cook Legacy loader Joomla



Dump the loader.

Your component handle a small script to dump in HTML the JLoader object.

use:

MycomponentClassLoader::dump()

Although I found this tool some time ago I just started learning experimenting and building this first component on Monday and now on Thursday afternoon it's already online. Although I already had a working version done with another tool this is much easier to build and at the end you have the freedom to own your own component. Once you know how to use Cook you will boost your productivity as the learning curve is really moderate compared to many other tools.
Giori (Forum)

Get Started