Skip to content
dbald edited this page Sep 16, 2010 · 2 revisions

Branches

Home > Branches

Branches are almost like another instance of the framework, except it bases itself and all of it’s innards to the base config. They are also accessed differently, even though they are set up in the /branches folder, you leave that part out:

/branches/admin

You get to the branch like this, assuming that localhost is pointed at an Evergreen framework:

http://localhost/admin

Aside from a few folders, a branch is set up almost identical to the root of the framework. The simplest branch would look something like this:

/branches
/branches/admin
/branches/admin/controllers
/branches/admin/public
/branches/admin/views

But if you wanted specific configs, helpers, plugins, or models, you would add them in just like you would in the root of the framework.

/branches/admin/config
/branches/admin/helpers
/branches/admin/models
/branches/admin/plugins

You just need to remember that because they are in the admin branch, you call them differently. Here’s some examples:

A model located in the root would be called like this:

<?php
$variable = new Name_Model();
?>

But if you stored this model in the admin branch, it would be like this:

<?php
$variable = new Name_Admin_Model();
?>

The name of the branch, which is automatically created if not specified, is required for the framework to know where it loads it from. So for a branch set up like this:

/branches/online-store

Your calls would like this:

<?php
$variable = new Name_OnlineStore_Helper();
$variable = new Name_OnlineStore_Model();
$variable = new Name_OnlineStore_Plugin();
?>

And this works backwards too. If you want to call something in the root from a branch, you would simply call this:

<?php
$variable = new Name_Model();
?>

Or from root to a branch:

<?php
$variable = new Name_OnlineStore_Model();
?>

Effectively, you could put all helpers, models, and plugins into the root, and never have to worry about calling them from certain branches… But if you only use the uploads helper in the branch, why keep it in the root?

Clone this wiki locally