Book Image

FuelPHP Application Development Blueprints

By : Sebastien Drouyer
Book Image

FuelPHP Application Development Blueprints

By: Sebastien Drouyer

Overview of this book

Table of Contents (13 chapters)
FuelPHP Application Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Subscription and authentication features


Instead of generating entire scaffolds, we will manually create controllers and views as we won't need most CRUD features.

Implementing the subscription and authentication forms

First, let's create the user controller. Create a file at APPPATH/classes/controller/user.php and set its contents to:

<?php
class Controller_User extends Controller_Template
{

}

The home page, which will be handled by the index action of the User controller, displays the user's posts if the user is logged in, otherwise it will display the subscription and authentication forms.

Since we have no user in our system, nobody can log in. Thus, we will begin the subscription and authentication forms.

First, add the following method in the User controller:

public function action_index()
{
    if (false /* is the user logged ? */) {
        // @todo: handle response if user is logged.
    } else {
        $this->template->content = 
            View::forge(
                'user...