August 28, 201313 yr Hey, I have just started to use my first php framework. Previously, i wrote everything from scratch. I have been recommended to use Lithium. I learn better when diving in the deep end and so far, it has been.. somewhat fruitful yet frustrating. I have managed to add a login/logout script with a private page. No worries. Thing is, documentation is thin. I know this is probably going to be the most basic of tasks (Doing it without a framework is easy). But i need to find out how to create session based links. (IE: LOGIN/LOGOUT on the conditions that the user is logged in or logged out obviously). Any help is much appreciated!
August 30, 201313 yr Author Solved, for future ref, heres how i did it. In Layouts default.html.php: <?php if($this->user->connected()){ echo '<a href="/lithium/lithgit/logout">Logout</a>'; } else { echo '<a href="/lithium/lithgit/login">Login</a>'; } ?> And then created a Helper called user.php and added the following: <?php namespace app\extensions\helper; use lithium\security\Auth; class User extends \lithium\template\helper { public function connected() { return Auth::check('default', $this->_context->_config['request']); } } Thanks guys.
August 31, 201313 yr Author I checked out Laravel 4. Completely agree with the documentation. Lithium lacks detailed documentation. To be honest, i found CakePHP to be pretty much the same framework as Lithium and much better documented so i have now moved over to CakePHP. Thank you for the heads up though!
Create an account or sign in to comment