I used \Theme::forge method. i have two themes set by default one for backend and frontend. what is the best way to impliment it.
i have used forge method, in public view and backend view.
each one in same directory app/themes... as app/themes/frontend & app/themes/backend theme name is same "default".template file is "template.php" My frontend theme controller is in bin. http://bin.fuelphp.com/snippet/view/LO
And then your template would be in D:\xampp\htdocs\dir.dev\fuel\app\themes\frontend\template.php.
This seems to be a better idea, so you have use a single theme instance, and use $this->theme->active('frontend') and $this->theme->active('backend') to switch between the two.
If you do it that way, they are in different folders?
Or do you want to have a selection of frontend themes, and a selection of backend themes? In that case it will probably make sense to split them like you did, and your config should work fine.
You haven't answered my question if the file path generated is the path where you have stored your themes? If that is not the case, how have you organised it?
i am storing my themes in App/themes/frontend or backend/default/template.php both have same structure, but frontend & backend folder difference. According to my knowledge, it should work, But it not working.
working perfect when created by instance, default config. but error when created with forge.
i checked both object with \Debug::dump() , but seem same, but forged one not working, instance working perfect, but in instance, i cant isolate folders, How i do so? Any way? Kindly Help
Instance() does exactly the same as forge(), only difference it that is stores the instance by name so you can retrieve it later, while forge() always forges a new object.
With that config, it tries to load the template from "D:\xampp\htdocs\dir.dev\fuel\app\themes\frontend\default\.\template.php", and I asked you if that file exists or not. Which you still haven't answered.
I have no clue where that "\.\" in that filename comes from, did you change something in the app/config/theme.php file as well?
So does this file exist or not, what is the exact error you are getting, and which file and which line throws the error?
\.\ is not a issue, i executed path with \.\ and without \.\ . both works fine. the file truely exist as you asked, the file works fine if i load the file using \Theme::instance();. i found using forge and instance both have \debug::dump() same.except a instance variable is set in instance object.
exactly i am confused. tried for 3 days now, the template object is set when dump, but still showing error Fuel\Core\ThemeException [ Error ]: No valid template could be found. Use set_template() to define a page template.
D:/xampp/htdocs/dir.dev/fuel/core/classes/theme.php @ line 354
if possible, kindly give me a working theme forge controller and a template file as bin, so that i can compare with it. must be forge type, as i need to host multiple theme in future.
screenshot attched for file structure. the opened php file is theme config file. http://imgur.com/sngs49t
and very wonderful matter i found is that, using both forge and instance, $this->theme->find('default'); return path same. thanks in advance
As I said, when you use forge(), you are just creating an object. Like you would when you use "new". But in the after() method when you render the page, you use Theme::instance().
This uses a COMPLETELY different instance of the Theme class. Do
var_dump($this->theme, Theme::instance())
and you will see that you have two different objects (check the object id).
So either use Theme::instance() everywhere, or use $this->theme everywhere, but don't mix the two.
For consistency I suggest you use forge() everywhere, and replace the line in after() with