Problem with view files

edited January 2013 in Modules
Im made folder named users in modules. In this folder i have 3 other "controllers" "models" "views". I want to build a login , register here . I created a view file named register.php and a controller named "users.php". In controler i have this code
class Users extends CI_Controller {

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

}

function index()
{
$vars['body'] = $this->load->module_view('users', 'register',$vars, TRUE);
$output = $this->load->view('_layouts/main', $vars, TRUE);
$this->load->module_library(FUEL_FOLDER, 'fuel_page');
$this->fuel_page->initialize();
$output = $this->fuel_page->fuelify($output);
}
}
?>
The view file loads my main.php layout form the _blocks located in fuel/application
but in the header block (which gets loaded in main.php) i used css() and js() to load assets like this


<?php if (!empty($is_blog)) : ?>
<?php echo $CI->fuel_blog->page_title($page_title, ' : ', 'right')?>
<?php else : ?>
<?php echo fuel_var('page_title', '')?>
<?php endif ?>




" />
" />

<?php echo css('style, css, mod, nivo-slider'); ?>
<?php echo css($css); ?>


<?php echo js('jquery, main, jquery_hide, jquery.nivo.slider.pack'); ?>
<?php echo js($js); ?>

<?php if (!empty($is_blog)) : ?>
<?php echo $CI->fuel_blog->header()?>
<?php endif; ?>
" />
now i get 3 notices in my view file

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: vars

Filename: controllers/users.php

Line Number: 14
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: css

Filename: _blocks/header.php

Line Number: 17
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: js

Filename: _blocks/header.php

Line Number: 21
and for page title i get <- this is from page source

Can you pls help me or explain me how exactly the variables are passed to my view or if i did something wrong, i c'ant realy get the grasp of fuelcms . Thank you!

Comments

  • edited January 2013
    for page title i get __FUEL_MARKER__0
    On a view file located in application/views everything is ok.
  • edited 6:09AM
    $vars is undefined at this line:

    $vars['body'] = $this->load->module_view('users', 'register',$vars, TRUE);

    Seeing __fuel_marker__ happens when there's an error on the page that halts processing.
  • edited January 2013
    any solutions? to get rid of that marker?
  • edited 6:09AM
    To get rid of the markers you need to get rid of the errors. To get rid of the errors, you'll need to pass in those variables in your controller like so:
    function index() { $vars = array(); $vars['css'] = array(); $vars['js'] = array(); $vars['body'] = $this->load->module_view('users', 'register',$vars, TRUE); $output = $this->load->view('_layouts/main', $vars, TRUE); $this->load->module_library(FUEL_FOLDER, 'fuel_page'); $this->fuel_page->initialize(); $output = $this->fuel_page->fuelify($output); }
Sign In or Register to comment.