Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
The requested view could not be found
  • Hi, forgive me if I'm posting in the wrong place. I'm trying to work through Phil Sturgeon's tutorial on NetTuts (http://net.tutsplus.com/tutorials/php/getting-started-with-the-fuel-php-framework/) and am getting the above error when attempting the Hello World example. Could somebody please explain what I am doing wrong? /blog/fuel/app/classes/controller/hello.php
    <?php
    
     class Controller_Hello extends Controller {
      
      public function action_index() {
       echo 'Hello World!';
      }
     
      public function action_buddy( $name = 'buddy' ) {
       $this->response->body = View::factory( 'hello', array( 'name' => $name, ) );
      }
      
     }
    
    blog/fuel/app/classes/view/hello.php
    <h1>Hello!</h1>
    <p>Hey <?php $name; ?>, how's it going?</p>
    
    /blog/fuel/app/config/routes.php
    <?php
    return array(
     '_root_'  => 'hello',  // The default route
    );
    
    Directory structure
    /
    -blog
    --fuel
    ---app
    ----classes
    -----controller
    ------hello.php
    -----view
    ------hello.php
    ----config
    -----routes.php
    --public
    ---index.php
    
    The Actual Error
    Fuel\Core\FuelException [ Error ]: The requested view could not be found: hello
    COREPATH/classes/view.php @ line 389

    Any assistance would be greatly appreciated.
  • View files go in app/views, not in classes/view (which is for viewmodel classes).
  • Thanks WanWizard, that was my misunderstanding of where to place the files. Much appreciated.

Howdy, Stranger!

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

In this Discussion