Welcome Guest, Not a member yet? Register   Sign In
Integrating Tank_Auth library into the template library - howto ?
#1

[eluser]Unknown[/eluser]
looked around but could't find an example.

i'm using the template library: http://williamsconcepts.com/ci/codeignit...rence.html

and would like to integrate the Tank_Auth authentication module to my pages,
so to have a login/logout/register form in a $topbar template region i created.
Also to be able to control the display of certain regions depending on the log in status.

I have tried to do this on the Welcome page Controller, but i'm stuck.

getting an error "Unable to load the requested file: Array.php"

can anyone lead me in the right direction ? thanks. this is what i have so far

Code:
class Welcome extends CI_Controller {


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

    $this->load->helper(array('form', 'url'));
    $this->load->library('form_validation');
    $this->load->library('security');
    $this->load->library('tank_auth');
    $this->lang->load('tank_auth');
}

public function index()
{

      $this->template->add_css('css/style.css',$type = 'link');

    // if not logged in, show log on form in the topbar
    if (!$this->tank_auth->is_logged_in()) {


          $data['loginform']='login_form';

          //redirect('/auth/login/');


          $this->template->write_view('topbar', $data);

          $this->template->write_view('content', 'blank');

          $this->template->write_view('sidebar', 'templates/sidebar');              



    } else {
    //user is logged in, show log in info in top bar

         $data['user_id']    = $this->tank_auth->get_user_id();
         $data['username']   = $this->tank_auth->get_username();

                 $this->template->write_view('topbar', $data);

             // Write to $content
             $this->template->write_view('content', 'member_content');

             // Write to $sidebar
         $this->template->write_view('sidebar', 'templates/sidebar');              

    }


  // Render the template
  $this->template->render();

}
}:question:


Messages In This Thread
Integrating Tank_Auth library into the template library - howto ? - by El Forum - 01-20-2012, 02:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB