[eluser]Andreas Karlsson[/eluser]
Just wrote a hook that someone might be interested in, it makes you able to use a default view in a region.
Make sure you load the hook file after template has loaded. eg, post_controller_constructor.
config/config.php
Code:
$config['enable_hooks'] = TRUE;
config/hooks.php:
Code:
$hook['post_controller_constructor'] = array(
'class' => 'Your_hook_class',
'function' => 'hook_function',
'filename' => 'your_hook_class.php',
'filepath' => 'hooks'
);
config/template.php:
Code:
$template['default']['regions'] = array(
'title',
'header',
'footer' => array(
'view' => 'partials/footer'
)
);
hooks/your_hook_class.php:
Code:
class Your_hook_class {
function hook_function()
{
require(APPPATH . 'config/template.php');
$ci =& get_instance();
$template = $template[$template['active_template']];
foreach ($template['regions'] as $key => $value)
{
if(is_array($value))
{
if(array_key_exists('view', $value))
{
$ci->template->write_view($key, $value['view']);
}
}
}
}
}
Hope it helps. If someone knows a better way, or has some questions. Feel free