Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Lithium Framework (PHP) Session based links

Featured Replies

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!

 

 

  • 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.

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.