Hi everybody,
I have several applications built with fuel with a backend.
My goal : share admin theme views and admin theme assets on the same server between apps.
I already share my admin theme views.
First, folder structure :
-- fuelphp (outside DOCROOT)
----1.7.1
-------- core
-------- vendor
----shared
-------- packages
-------- modules
-------- themes
-- www (Server DOCROOT)
---- app1 (http://app1.local)
-------- index.php
-------- assets (css, js, img, themes)
-------- app (classes, config, modules........)
---- app2 (http://app2.local)
-------- index.php
-------- assets
-------- app (classes, config, modules........)
---- shared_assets (http://shared.assets.local)
-------- css
-------- js
-------- img
-------- themes
---------------- admin
-------------------------- css
-------------------------- js
-------------------------- img
In app1/index.php :
define('SHAREDPATH', realpath(__DIR__.'/../../fuelphp/shared/').DIRECTORY_SEPARATOR);
In config/theme.php :
return array(
....
'paths' => array(
APPPATH.'..'.DS.'themes',
SHAREDPATH.'themes', //location of my admin theme views
),
....
);
But I don't know how to share admin theme assets.
I try this technique
http://fuelphp.com/docs/classes/theme/advanced.html#/advanced_config
to add new asset base url.
In my Base Controller Template :
public function before()
{
$theme = \Theme::instance();
$theme->active(array(
'name' => 'admin',
'path' => SHAREDPATH . 'themes/',
'asset_base' => 'http://shared.assets.local',
));
......
}
But it doesn't work, i have always http://app1.local (Config::get('base_url')) like base url.
For global assets, i changed base url on the fly with Asset class.
In my Base Controller Template :
\Asset::forge('shared', array( 'url' => 'http://fuelphp.shared.local:8080/'));
And in the view theme :
echo \Asset::instance('shared')->css(array('bootstrap.css', 'font-awesome.css'));
This works!
So how configure theme class to add new base url asset?
It looks like you're new here. If you want to get involved, click one of these buttons!