Page title

edited May 2019 in Support

I have my advanced module and all of the pages have similar title problem. One my pages is a form to add a test and the page title looks like this:
<!--__FUEL_MARKER__0-->Add test, but that should be just Add test
I can't find a way to change it.

In controller I define a title for the page:
fuel_set_var('page_title', 'Add test');
and in the view file I echo this title:
echo '<h1>'.fuel_var('page_title').'</h1>'

How should that be properly done?


  • The fuel_set_var function will add a variable with the inline editing code in place. The inline editing code will get cleaned up if the page is rendered via $this->fuel->pages->render('my_view', $vars);
    If you don't need the inline editing code, you can simply just use $page_title.

  • edited September 2019

    I have tried to render the page via $this->fuel->pages->render('my_view', $vars); but I'm getting the compile error:

    Message: Cannot declare class Ion_auth_model, because the name is already in use
    Filename: models/Ion_auths_model.php
    Line Number: 28

    So I render the page with $this->show_page('my_view', $vars);

    Is that correct?

  • That error message can sometimes be due to a casing difference on the file. Is the model's file name "Ion_auth_model" or "ion_auth_model"? Also, how is that class being loaded into the page (e.g. $this->load->model(...), require, include, etc)?

  • edited February 2020

    The model's file name is "Ion_auth_model" with first capital letter.

    The class is loaded in the controllers construct function with $this->load->library('ion_auth'); :

    class Sportcenter extends CI_Controller {
        public function __construct()
            if (!$this->ion_auth->logged_in())
                redirect('/auth/login', 'refresh');

    What are your thoughts?

  • Within the "Ion_auth_model" model, is the model's class name the same? ie. with a capital letter

  • edited February 2020

    Yes. I have even updated the Ion Auth and still the same - page titles in the browser tab are <!--__FUEL_MARKER__0-->My view. :neutral:

    I have commented several mods and now when I try to render a page with $this->fuel->pages->render('my_view', $vars); I see a blank page.

  • If you are seeing FUEL_MARKER, that means there is an error in the rendering. Do you have errors turned on in the index.php / environment by chance?

  • edited February 2020

    If you are asking for settings in fuel/application/config/config.php then $config['log_threshold'] = 2; and in fuel/application/logs/log-2020-02-04.php I see no errors.

    phpinfo() shows that display_errors is On and display_startup_errors is On.

    In the beginning of index.php I have:

    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);

    Also no errors in the logs from my hosting service.

    Should I turn on errors some other way?

    The problem with title appear only in my advanced module. On the other pages generated in Fuel CMS the title is as it should.

    I have tried with removing any Ion Auth use (f.ex. from initialization and further) but nothing changed.

    I forgot to add that for page rendering I use below code (this is my function show_page($my_view_file)):

            $this->load->view($my_view_file, $vars);

    Maybe I should just leave that fuel_set_var('page_title', 'My view');and change the title through simple $vars? But that will make problems with CMS titles.

  • Is your error code in index.php after line 167 or so?

  • edited February 2020

    I have paste it after ERROR REPORTING section and no change.

    The only error I got from the error log from my hosting service is this one that appear on every http request:
    [Wed Feb 05 23:32:02 2020] [error] [client] request="GET /about HTTP/1.1" pid=140157667802704 uid=3932064 gid=3932064, referer:
    but I don't think it is relevant. On the other hand it shouldn't be there as the data is valid and is accessible and the webpage is displayed properly, especially that one.

  • If you are seeing __FUEL_MARKER__0 then that is an indication of the page exiting because those markers get cleaned up before rendering unless there is an error halting execution... or the page was cached with that error. You may also want to try clearing the Page Cache in the CMS.

  • edited March 2020

    I found why the render() function showed a blank page and how to render the view.
    Then, setting the page title was just a matter of adding the element to $vars.

    The issue is when I call $this->fuel->pages->render('my_view', $vars); in the controller in my advanced module. The first parameter is the LOCATION (haha, thank you User guide). Not only the name of the view in modules/advanced_module/views folder how I thought.

    So I found that render() looks for 'my_view' in application/views despite my advanced module's views folder so I had to implement such awful thing: $this->fuel->pages->render('../../modules/advanced_module/views/my_view', $vars);.
    The same situation is when I want to define a layout in $vars in a controller or include $this->load->view('_blocks/header_logged_in') in any files in my advanced module.

    How that should be solved?
    I think that advanced module should target to it's own files as blocks, views and layouts without implementing such paths.
    Should I set somewhere the path to the advanced module's folder for use for other functions?

  • There is a third parameter you can use to specify the name of the advanced module:
    $this->fuel->pages->render('my_view', $vars, array('view_module' => 'my_advanced_module'));

  • That renders a web page without any layout (header and footer). Where a layout should be defined?

    I've tried with

    echo $this->fuel->blocks->render( 'header_logged_in', $vars );
    $this->fuel->pages->render('my_module', $vars, array('view_module' => 'advanced_module'));
    echo $this->fuel->blocks->render( 'footer', $vars );

    but that renders blocks at the top of the page, a page is rendered below footer and page title contains FUEL_MARKER as previously.

    If I use $this->load->view('_blocks/header'); instead of above's blocks->render the page is showed without those blocks - similar to wrong location of the called blocks. But when I comment the page->render the blocks appears.

  • You can also assign a layout in that third parameter:
    $this->fuel->pages->render('my_module', $vars, array('view_module' => 'advanced_module', 'layout' => 'my_layout'));

  • edited March 2020

    That doesn't change anything. Even if I set a layout main which is present in both folders: application/views/_layout and modules/advanced_module/views/_layout.

    I was trying to get a page object and assign_layout() or define layout_path or layouts_folder in the module's config file and none of these works. :(

    While doing a lot of changes I found that view_module parameter is taken into account and whatever I enter into layout it doesn't change anything. I have also tried adding views_path but blank page appeard.

  • I think I would need to take a look at the entire code structure to see what may be going on to track how it is determining which layout (or no layout).

  • edited March 2020

    This is a way of rendering a page within a layout in the advanced module:

    $vars['layout'] = 'main';
    $this->fuel->pages->render('my_view', $vars, array('view_module' => 'advanced_module'));

    Thank you admin :)

  • edited March 2020

    One more thing - in order make that work the fuel/application/config/MY_fuel_layouts.php must contain layout configuration like this:

    $config['layouts']['layouts_filename'] = array(
        'module' => 'advanced_module',

    'layouts_filename' must be different than existing filenames in fuel/application/views/_layouts and unique among configured layouts in MY_fuel_layouts.php.

Sign In or Register to comment.