Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Quick question regarding Templates
  • I've created a really basic Controller as you can see below:- class Controller_Users extends Controller_Template { public function action_index()
    {
    $this->template->title = 'Homepage';
    $this->template->content = View::factory('index');
    } public function action_register()
    {
    $this->template->title = 'Register';
    $this->template->content = View::factory('register');
    }
    } As expected the index view loads fine but when I click on the 'Register' link on the homepage the register view is not loaded, instead I get the 'Undefined variable: content' notice? Could someone explain what I'm doing wrong please? I had it working fine when I was using:- $this->response->body = View::factory('index', $data); But now I want to use Fuel's template view. Sorry this is really basic but I'm new to FuelPHP and PHP frameworks as a whole!
  • Did you use the right link: users/register?
    Did you use some route rule?
  • All my view files are in the View folder currently:- Views
    - index.php
    - register.php
    - login.php Are you referring to the routes.php file in the 'config' folder? If so then no.
  • Mmm... Reading your post it seems to be a perfect work... I think is a little mistake, but it's difficult to find... Can you poste some more code? Like file route.php, you controller and view? http://scrp.at/
  • Solved! Just as I was about to reply listing my code I noticed in the template.php view file I was calling <a href="index/register">Register</a> when in fact it should be <a href="users/register">Register</a>. Thanks for your help anyway.
  • Marco Pace wrote on Wednesday 7th of September 2011:
    Did you use the right link: users/register?
    Did you use some route rule?

    Oh yes! My first help :D, hally to know that you solved it!

Howdy, Stranger!

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

In this Discussion