Render not working. Am I missing something?

I have the following controller. AM I missing something?

require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php');

class Appointments extends Fuel_base_controller {

function __construct()
{
parent::__construct(FALSE);
}

function index()
{
$vars['body'] = $this->load->module_view(APPOINTMENT_BOOKER_FOLDER, 'themes/default/contact_us', $vars, TRUE);
$vars['layout'] = 'main';
$this->fuel->pages->render('appointments/create',$vars);

}
}

Comments

  • edited 4:38PM
    What are you seeing instead? Also, do you have a view or a page created in the CMS of "appointments/create"?
  • edited 4:38PM
    i see a blank page.

    i created the view in

    /fuel/modules/appointment_booker/views/themes/default/contact_us.php

    to load that, i used

    $vars['body'] = $this->load->module_view(APPOINTMENT_BOOKER_FOLDER, 'themes/default/contact_us', $vars, TRUE);

    is it because i'm incorrectly rendering?

    $this->fuel->pages->render('appointments/create',$vars);

    i tried:
    render('appointment_booker/appointments/create',$vars);
    render('appointments/create',$vars);

    still no luck. any thoughts?
  • edited 4:38PM
    It looks like you have your view in an advanced module correct? If so, you will need to pass an additional parameter to look in that folder instead of the application folder:
    $this->fuel->pages->render('appointments/create',$vars, array('view_module' => APPOINTMENT_BOOKER_FOLDER));
    It will then look for a view file of 'appointments/create' in the APPOINTMENT_BOOKER_FOLDER instead of the application folder.
  • edited 4:38PM
    i just tried that and it didn't work...

    this seems related to another problem i had when i try to load a module model. for some reason, it will only pick up models in the application folder (non-module folder).

    i will do a fresh install and see if it fixes it but please let me know if there is some sort of configuration i'm not aware of that may be causing it.
  • edited 4:38PM
    Although I don't know if it will help in this situation, but try adding the 'render_mode' => 'view' to the passed parameters as well:
    $this->fuel->pages->render('appointments/create',$vars, array('view_module' => APPOINTMENT_BOOKER_FOLDER, 'render_mode' => 'view'));
    And just to be sure, you have a view file located at fuel/modules/{APPOINTMENT_BOOKER_FOLDER}/views/appointments/create?

    For the models, you need to specify the model_location parameter for your module in your MY_fuel_modules.php file:
    .... 'model_location' => APPOINTMENT_BOOKER_FOLDER, ...
Sign In or Register to comment.