php - which one is a better practice, storing login status bar html code in view or model in codeigniter? -



php - which one is a better practice, storing login status bar html code in view or model in codeigniter? -

i have login status bar in header template, shows "login" when user did not log in, , shows user's name 1 time logged in.

i'm confused in how if/else logic should performed. had login/not-login html code stored in user model, had controller handle , if/else grab code model, pass header template. or had both login/not-login code typed header template, , controller if/else generate true/false flag, , pass flag view.

which 1 improve practice?

never add together html model. whole , sole purpose of model fetch data. should add together if-else status in header view.

when user logs in, create session in model, store userid, first name , lastname.

in header view check if session exists, if exists show user logged in his/her name or else display login button.

php codeigniter login

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -