Hiya,
I am starting a project where on one part of the website is a section where clients can update their personal information. The personal information has nothing to do with site members or anything EE related.
The client information is going to be stored in a custom table in the database.
Next this means I need a page with a login form, and if the information is correctly submitted a page with the user info that can be changed. I have a couple ideas on how to do this. But what would be the way to this with EE. I know i’ts CI powered, and I know how to use CI, but I am not entirely understanding how to use it in EE for this kind of functionality?
Can I make something like a model, controller and view like I would while building a CI only app, or do I need a completely different approach?
Thanks!
[Mod Edit: Moved to the Development and Programming forum]
Ok, found some info here:http://ellislab.com/forums/viewthread/173649/
But the barebone controller leaves a blank page:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Test Controller
*
* @package default
* @author Jesse Bunch
**/
class Test extends Controller {
/**
* Construct
*/
function Test()
{
parent::Controller();
// Calls the EE & CI initialization
$this->core->_initialize_core();
$this->EE =& get_instance();
}
// --------------------------------------------------------------------
/**
* Index
*/
function index()
{
$this->load->view('test');
}
}
/* End of file test.php */
/* Location: ./system/expressionengine/controllers/test.php */Right now I am using this, but I would like to use a “normal” constructor.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Contact_checker extends CI_Controller
{
private $data = array();
public function construct()
{
$this->load->model('contact_checker_model');
$this->data = $this->contact_checker_model->general_data();
}
public function show_page()
{
$this->construct();
$this->load->view('contact_checker_view', $this->data);
}
}
?>Hi Sanity,
Well the reason you are getting blank pages for your custom controller is because it is using the outdated constructor format.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Test Controller
*
* @author Barry Cogan
**/
class Test extends CI_Controller {
/**
* Constructor
*/
// PHP 5+ prefers use of __construct() instead of classname() This is required to work in EE 2
function __construct()
{
// Call the CI_Controller's Constructor
parent::__construct();
// Calls the EE & CI initialization
$this->core->_initialize_core();
$this->EE =& get_instance();
}
// --------------------------------------------------------------------
/**
* Index
*/
function index()
{
// load a view from ./system/expressionengine/views/
$this->load->view('test'); // ./system/expressionengine/views/test.php
}
}
/* End of file test.php */
/* Location: ./system/expressionengine/controllers/test.php */You will run into some issues doing this though. I am failing to see why you don’t just go ahead and make a set of templates for that specific parts of the site. You could use safecracker add-on for the necessary form information. I believe this would save you headaches down the line as modifying the core like that will prevent you from easily updating the software in the future.
Best regards, Barry
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.