![]() |
session in the view file - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: session in the view file (/showthread.php?tid=8121) |
session in the view file - El Forum - 05-06-2008 [eluser]stalwart[/eluser] This may be a stupid quersion but ..... How can i make this in CI in the view file if (session_is_registered('username'){echo 'something';} else {form for login} session in the view file - El Forum - 05-06-2008 [eluser]xwero[/eluser] It's best you do this is a controller method and create two views. session in the view file - El Forum - 05-06-2008 [eluser]stalwart[/eluser] [quote author="xwero" date="1210104042"]It's best you do this is a controller method and create two views.[/quote] but i am using template engine and it will be complecated session in the view file - El Forum - 05-06-2008 [eluser]xwero[/eluser] How would it be more complicated? session in the view file - El Forum - 05-06-2008 [eluser]stalwart[/eluser] [quote author="xwero" date="1210104469"]How would it be more complicated?[/quote] I am using maintemplate so i have to make 2 main templates and in every output if($this->session->userdata('username')){$maintemplate='logged';} else {$maintemplate='notlogged';} $this->template->load($maintemplate, 'view_file', $data); session in the view file - El Forum - 05-06-2008 [eluser]Mirage[/eluser] Just because you're making the test in the controller doesn't mean you have to split your template: Code: class SomeController extends Controller() { In the template: Code: <?php if($loggedin!==false):?> Hope this helps. session in the view file - El Forum - 05-06-2008 [eluser]stalwart[/eluser] that works |