Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Installation & Setup
After spending the last two hours playing with themes, trying to get them to work i cannot seem to get it to function.
Whenever i try to use it i get the following error
Fuel\Core\FuelException [ Error ]:
The requested view could not be found: template/default
However, if i set $theme->set_template to a file found in my views, it loads that file.
I thought the purpose of themes are to have separated templates & pieces from other themes.
When using the save_info command, the theme info file is written to app/config/<theme info filename>.php, instead of the the theme/default/themeinfo.php file.
In regards to save_info I've submitted a patch to correct this... Not sure if its an intentional or not, but it caused some grief, so yeah.
When you bump into issues like this, always check the latest develop branch to see it is already fixed. Would have saved you the grief, because this issue was fixed some time ago.
Your setup looks fine, I have compared it to my apps here, and it's identical, only difference is we don't have the themes inside the docroot.
You're info file doesn't contain a 'find_file' entry by any chance (which disables the theme loading mechanism)? Or an incorrect 'path' entry which will overwrite the configured and calculated path to the theme?
All file location actions are done by the internal find_file() method in the Theme class. Both for View loading and for info file loading and saving. Since the last works file, I can only conclude that your config is ok.
Perhaps you have bumped into another bug that is already fixed in 1.8/dev? All our apps run on 1.8/dev, and I have no issue whatsoever with themes.
using $this->theme->find_file produces this error
ErrorException [ Fatal Error ]:
Call to protected method Fuel\Core\Theme::find_file() from context 'Controller_Themetest'
changing it to a public method (just for testing) produces this
It is not grabbing the files.
Also i am not using find_file (as you can see in my config).
What is the process of upgrading fuel to the develop branch?
Nevermind, figured out how to upgrade.
git checkout 1.8/develop
However, after upgrading to the 1.8/develop, i am still getting the same error message
you can see it here
Had to rollback because a few items got removed by composer when i updated it lol.
Also, going to just note here
Even after upgrading to 1.8, what my pull request fixed, is still broken.
If you use save_info it does not write the file into the theme folder, instead it writes it into the app/config/ folder.
If you installed Fuel from zip, switch to a git clone. If you have git local, you can use "oil create <path>" to create a new Fuel installation.
If you have a git driven installation, go into the root, fuel/core and all fuel/packages, and go "git checkout 1.8/develop" followed by a "git pull" to make sure you're up to date.
But if I check the commit history of the Theme class, there have not been any changes recently, see
. What version of Fuel are you using?
Does this info file already exist, or not?
save() is not meant to create new info files, it's just meant to update existing files. find_file() can not return a path to a file that isn't there.
This commit fixed the issue you have in save() (this missing 'name' index), and it's from two years ago, so not sure on which code base you are:
Firstly, sorry about the delay in communication, i had pulled an all nighter and finally crashed.
Harro, I am using 1.7.1, it was a fresh install from oil using 'oil create di' two weeks ago.
You are correct on the missing name/path index part, which would have caused errors to be generated.
However if you look at load_info on your find_files you pass array($theme) not array($theme['name']) by passing array($theme['name']) you are dropping all of the path information off when looking up files, causing it to no longer have the $theme['path'] available inside of find_files.
I have tested with my patch against 1.7 and 1.8 and it resolves my issue with save_info on both.
having $theme['name'] results in a path of app/config/<filename>
having $theme results in a path of <path/to/themes>/<theme>/<filename>
Seems I had a similar problem, causing me to look with my nose...
I thought you added the 'name' index, but you removed it, which is correct, I'll merge the PR.
I do not know what changed (doing a diff now) but it seems to have started working.
Probably a file that didn't fully save when uploaded even though i had double checked a few of them.
Sucks to be on a crappy ISP, if i find out what the cause was I'll be sure to post it.
Also, on the note about the theme info file, i know its not supposed to create it, that would be pointless, but if you have data that can be configured on the themes, it helps to have the save function working (hence my pull request). Thank you for your time looking into this, i was likely too tired and overlooked something with the themes.
Add a Comment
It looks like you're new here. If you want to get involved, click one of these buttons!
Apply for Membership
↳ Job Board
↳ Installation & Setup
↳ Tips and Tutorials
↳ Code share
In this Discussion