Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Template controller is not working
  • Hello, I got a fuel php project from my client. i see the code of fuel php and i understand the working of that project then i want to create a page and link with exist template into my controller page.
    I am create a page controller and view page also, when i view my page from controller is working fine but when i use my current template of my code is not working. I am shareing the both codes with you below.
    Previous code from Project:
    <?php

    class Controller_Public_Aboutus extends Controller_Public
    {

    public function action_index($lang = null)
    {
    $current_language = parent::before();

    $data['aboutus'] = Model_About_Aboutustr::find('all', array(
    'where' => array(array('language_id', $current_language)
        )
       )
    );

    $this->template->title = "About us";
    $this->template->content = View::forge('public/aboutus/index', $data);
    }

    }

    My code:
    <?php
    class Controller_Public_Askanexpert extends Controller_Template
    {


    public function action_index()
    {
       $data= array();
        $this->template->title = "Ask an";
        $this->template->content=View::forge('public/askanexpert/index');
    }

    }

    Existing code are able to access current template but my code is not able to accessing the template.
    Please if any expert in FuelPHP, please help me to solve this problem.

  • HarroHarro
    Accepted Answer
    What exactly doesn't work? 

    Please describe what you expect to happen, and what does happen. Also any error messages or log entries can be useful.
  • Hello Harro, I am want project template use in my view page.

    My website is working fine,In my website i created a template for main header and footer seperate in view section inside template.php .I am creating a controller(Ask an expert) and use controller template code inside action_index function but whenever i am use controller template code its give me unexpected error.
    This template code is working perfect in other pages but when i use in my new page its not working.

    (Its working fine)See this About us page link :  http://ehinga.org/eng/aboutus

    This is my page link but its not working, see the link below
    http://ehinga.org/public/askanexpert

    Please give me any solution.
    Regards ,
    Mohit

  • Hello Harro,

    I am adding template  controller in many ways but i can't find any solution.

    Please solve this issue.

  • You don't provide any information, so I can't help. For starters, if you get an error, what error is it?
  • Website :  http://ehinga.org/public/askanexpert&nbsp;
    This is my Ask an Expert page link, this page contain the error.



    Here its the code of Ask an Expert page Controller :
    <?php
    class Controller_Public_Askanexpert extends Controller_Template
    {


    public function action_index()
    {
       $data= array();
        $this->template->title = "Ask an";
        $this->template->content=View::forge('public/askanexpert/index');
    }

    } 



    Template controller is not working in this code. Solve this Probem
    I am attaching a image that shown my error page.
    image

  • HarroHarro
    Accepted Answer
    The page error is a routing error, so it can't find the controller that should serve that page. 

    The name of the controller looks file, so perhaps there is custom routing defined that overrides the standard mapping. It could also be a rights issue, check if the webserver had read access on the controller and related files.

    Oops errors generally programming errors which are logged in the log file.
  • Hello Harro,

    I expect your suggestion and change my router inside and add change path and now its working. 

    Thank you so much.
    Mohit Singh Rathore

Howdy, Stranger!

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

In this Discussion