Prog_Rookie
Prog_Rookie

Reputation: 448

Yii framework folder structure

Hi i have made a web application by using yii framewrok. Currently its perfectly working, but as i went through yii forums i realized my folder structure is not the perfect one as described. I want to make it a proper yii framework supported web application folder structure. if i put a part of the sitecontroller.php

if(isset($_POST['LoginForm']))
        {
            $form->attributes=$_POST['LoginForm'];
            // validate user input and redirect to previous page if valid
            if($form->validate()  && $form->login()){
                $_SESSION['username'] = (Yii::app()->user->username);
                $this->redirect(Yii::app()->getBaseUrl(true) . '/../index' );
            }
            else($this->redirect(Yii::app()->getBaseUrl(true) . '/../login' ));

        }

this shows that without making a simple call i have to make extra coding to call my scripts because of the folder structure. so can anybody help me on putting the files on the correct place on my yii directory, below picture shows the current folder structure

enter image description here

Upvotes: 0

Views: 3844

Answers (1)

andrzej1_1
andrzej1_1

Reputation: 1193

Just move all files from Login_yii to parent directory and you will be able to call:

$this->redirect('login.php');

P.s You should move code from files to actions in controllers and after that you could call e.g. $this->redirect('site/login')

Upvotes: 0

Related Questions