It looks like you're new here. If you want to get involved, click one of these buttons!
$account_controllers = array('customers', 'orders', 'order');
foreach($account_controllers as $c)
{
$route[FUEL_ROUTE.'account/'.$c] = FUEL_FOLDER.'/module';
$route[FUEL_ROUTE.'account/'.$c.'/(.*)'] = FUEL_FOLDER.'/module/$1';
}
require_once(FUEL_PATH.'/libraries/Fuel_base_controller.php');
class Order extends Fuel_base_controller {
function __construct() {
parent::__construct();
$this->load->library('form_validation');
$this->load->database();
$this->load->helper('form');
$this->load->helper('url');
$this->load->model('order_model');
}
function index() {
$this->form_validation->set_rules('name', 'Name', 'required');
$this->form_validation->set_rules('content', 'Content', '');
$this->form_validation->set_error_delimiters('<br /><span class="error">', '</span>');
if ($this->form_validation->run() == FALSE) // validation hasn't been passed
{
$this->load->view('order');
}
else
{
$form_data = array(
'name' => set_value('name'),
'content' => set_value('content')
);
if ($this->order_model->SaveForm($form_data) == TRUE) // the information has therefore been successfully saved in the db
{
$this->load->view('success');
}
else
{
echo 'An error occurred saving your information. Please try again later';
}
}
}
}
require_once(FUEL_PATH.'models/base_module_model.php');
class Order_model extends Base_module_model {
function __construct() {
parent::__construct();
}
function SaveForm($form_data) {
$this->db->insert('order', $form_data);
if ($this->db->affected_rows() == '1')
{
return TRUE;
}
return FALSE;
}
}
Comments
Undefined variable: js
and
Undefined variable: css
<?php echo css($css); ?> <?php echo css($js); ?>
then the page displays fine, but I was reluctant to remove it incase it was relied upon by another part of fuel.
Also, I also found that if I use Fuel_base_controller with
parent::__construct(FALSE);
then the page displays without redirecting to fuel login.
//$this->load->view('order'); //Removed $vars = array('page_title' => 'Order'); $output = $this->load->view('order', $vars, TRUE); $this->load->module_library(FUEL_FOLDER, 'fuel_page'); $this->fuel_page->initialize(); $output = $this->fuel_page->fuelify($output); $this->output->set_output($output);
This also removed the Fuel Markers too.