Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Fuel\Core\FuelException [ Error ]:
  • Ok I'am getting this error after uploading to my website.

    Fuel version 1.8 Dev newest version updated this morning...
    Pages were generated using the oil admin command.
    Using Ormauth login works find to the dashboard.

    Everything runs fine on my local system, On the live website I can go to the main page and the dashboard no errors it happens when I click on the dashboard to view the pages.

    ERROR:

    Fuel\Core\FuelException [ Error ]:
    The requested view could not be found: admin/pages/index

    COREPATH/classes/view.php @ line 388

    383        \Finder::instance()->flash($this->request_paths);
    384
    385        // locate the view file
    386        if (($path = \Finder::search('views', $file, '.'.$this->extension, false, false)) === false)
    387        {
    388            throw new \FuelException('The requested view could not be found: '.\Fuel::clean_path($file));
    389        }
    390
    391        // Store the file path locally
    392        $this->file_name = $path;
    393
    Backtrace

    COREPATH/classes/view.php @ line 120
    COREPATH/classes/view.php @ line 92
    APPPATH/classes/controller/admin/pages.php @ line 12
    COREPATH/base.php @ line 457
    COREPATH/classes/controller/hybrid.php @ line 80
    COREPATH/classes/request.php @ line 444
    DOCROOT/index.php @ line 51
    FuelPHP is released under the MIT license.

    It fines the dashboard view etc its only when it tries to access the views folder I' am getting this error.

    Thank you

  • If it work locally, I can only assume that the Fuel side of things is ok.

    Maybe a problem with syncing the files to the live site, or a rights issue (the webserver on the live site can't read the files)?
  • Thanks Harro, I dig into it more

  • Hi Harro, I found out what was wrong not sure if it is a bug in oil or what!

    The errors were caused by all the method lines with View::forge():

        // Error on the first \ should be / generated by oil admin pages
        $this->template->content   = View::forge('admin\pages/index', $data);

        // Had to change them all to like this for it to work.
        $this->template->content   = View::forge('admin/pages/index', $data);



    Thank you for your help and please check to see if this is an error generated by fuel oil admin.

    UPDATE:
    I also changed them like that on my Windows 7 Pro local host and it still works, so problem only shows up on the live server.

    This is strange I took a look at the oil admin source and it looks correct so no idea how those got changed.

    I generated a new admin comments and this is what displayed in the terminal and the files so it is oil thats doing it, its putting the wrong slash after views in the source files. The rest are ok.
    !
    ----------------------------------------------------------------------------------|-------- see the wrong slash.
    Creating view: C:\xampp\htdocs\fuel-nikita\fuel\app\views/admin\comments/index.php
            Creating view: C:\xampp\htdocs\fuel-nikita\fuel\app\views/admin\comments/view.php
            Creating view: C:\xampp\htdocs\fuel-nikita\fuel\app\views/admin\comments/create.php
            Creating view: C:\xampp\htdocs\fuel-nikita\fuel\app\views/admin\comments/edit.php
            Creating view: C:\xampp\htdocs\fuel-nikita\fuel\app\views/admin\comments/_form.php

    Live server is Linux with Apache


  • Are you on an older version of Fuel?

    Not to long ago a lot of effort was put into dealing with the stupid Windows backslashes...

    Can you try switching to the oil package from 1.8/develop, and see if that still generates incorrect code, before I start a wild ghost chase?
  • No see above FuelPHP 1.8 Dev updated this morning
  • It's putting the first slash as a \ it had to be changed to a / slash for it to work. But oil admin is generating this

  • php oil generate admin comments article_id:int user_id:int user_name:varchar[50] user_email:varchar[255] is_published:int date_published:datetime comment_content:text -s

    And this is how its generating the slashes in the source code.

        ------------------------------------------------------------------|---- should be a / not a \
        $this->template->content = View::forge('admin\comments/index', $data);

    Problem only shows up on live server, but I changed the local source to the / and it still works on Windows 7 Pro with no errors.

    You don't have to chase it, I'll look at the source and see if I can find the problem.
  • pakages/oil/classes/generate.php line 135 to 187 FuelPHP version 1.8 Dev Today

    Problem seems to be with the DS in here with the $filename.

    Portable PHP code: DIRECTORY_SEPARATOR is not necessary

    In attempting to write cross-platform, portable PHP code, I used PHP’s DIRECTORY_SEPARATOR constant to write path strings, e.g. "..".DIRECTORY_SEPARATOR."foo", because the “proper” way to do it on Windows would be "..\foo" while on everything else (Linux, UNIX, Mac OS X) it would be "../foo".

    Well, as Christian on php.net pointed out and the guys at Web Design Forums confirmed, that’s completely unnecessary. As long as you use the forward slash, “/”, you’ll be OK. Windows doesn’t mind it, and it’s best for *nix operating systems.

    (Note that DIRECTORY_SEPARATOR is still useful for things like explode-ing a path that the system gave you. Thanks to Shadowfiend for pointing this out.)

  • HarroHarro
    Accepted Answer
    It still means that all file data you get from the OS will contain backslashes, so you're not completly out of the woods by just using the forward slash in your code.

    This means another screening of the oil codebase is needed, not looking forward to that... :-(
  • Ok, I just have to deal with it for now.

    Thank you very much for your help.

  • I tracked it done to it being this and here is the fix

    packages/oil/classes/generate/scaffold.php Lines 85 to 92

    // Either foo or folder/foo
    $view_path = $controller_path = str_replace(
    array('_', '-'),
    '/', //DS, change the DS to '/' that fixes the problem, see below same code.
    \Str::lower($controller_name)
    );

  • fuel/packages/oil/classes/generate/scaffold.php Lines 85 to 92

    change the ds to '/' and it will fix it.

    Not sure if the model one below it will also need to be fixed.

    I created an issue on github for it. with the fix code.
  • HarroHarro
    Accepted Answer
    Thanks!
  • No problem anytime.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion