Management System, at the same level of the cake core. Similar to
WildFlower CMS. I use cakePHP's additional class paths to include the
code. I have it up and working, but when I want to customize the
User Controller, I have to copy the whole controller into my app
directory, and modify the code. I want to be able to keep theUser/
Content Management completely seperate from my app, so I won't have
to diff the code everytime I make a change. How can I create a
callback system, that triggers before, or after an action in the
management system fires, and have it trigger a controller/method in
my App Directory. I found this code in the AppController of
WildFlower, but it still seems to not work. I guess it is still
under construction.
/**
* @TODO Under construction
*
* Launch callbacks if they exist for current controller/method
*
* Callback for controllers are stored in <code>app/controllers/
wildflower-callbacks/</code>.
* The name convencions is unserscored class that you want to plug
into with "_callback"
* suffix. Examples:
*
* - pages_controller_callback.php
* - comments_controller_callback.php
* - wildflower_app_controller_callback.php
*
* @param string $when Launch <code>before</code> or <code>after</
code> current action
*/
function wildflowerCallback($when = 'after') {
// app_controller
if (class_exists('AppControllerCallback')) {
$plugin = new AppControllerCallback;
foreach (array('beforeFilter', 'afterFilter') as $filter)
{
$method = $filter;
if (method_exists($plugin, $method)) {
$plugin->{$method}();
return;
}
}
}
$className = Inflector::camelize($this-
>params['controller']) . 'ControllerCallback';
if (class_exists($className)) {
$plugin = new $className;
$method = $when . '_' . $this->params['action'];
if (method_exists($plugin, $method)) {
$plugin->{$method}();
return;
}
}
}
I definitely can use help on this. Thank you.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment