Welcome Guest, Not a member yet? Register   Sign In
Set up config item dynamically
#1

[eluser]Cgull[/eluser]
Hello,

I am using tank_auth for my login system.

I would like the login form to open different views after the user loggs in.

I read the config class, and try to set up a config item to tell the login form which view to open.

In the tank_auth config file I added:
Code:
$config['view'] = '';

In the tank_auth library I added two functions:
Code:
function setNextView($view)
{
  $this->ci->config->set_item('nextview', $view);
}
//I have tried $this->ci->config->set_item('nextview', $view, 'tank_auth'); as well

function getNextView()
{
  return $this->ci->config->item('nextview');
}

In my controller I am coding:
Code:
$this->tank_auth->setNextView('viewname');

In my login form I am coding:
Code:
$view = $this->tank_auth->getNextView();

When I run the login form I get this error: Undefined variable: nextview

What am I doing wrong?

Is there any other way to do what I need to do?

Thank you
#2

[eluser]Cgull[/eluser]
Sorry, my mistake. I found the problem with the error message, but I still have a problem.

The config item had no value in it.

So the $view variable is empty.




Theme © iAndrew 2016 - Forum software by © MyBB