Welcome Guest, Not a member yet? Register   Sign In
Portal with login box
#1

[eluser]roflskater[/eluser]
Dear codeigniter developpers,

I'm busy making a user registration system based on codeigniter. This is going quite well, since it's easy to jump into CI, but I'm stuck at this moment.
For my site I'd like to have a main page (portal), and on this portal I want a div including my login page. My login page is a controller which processes the login, outputting into a view as seen in the video tutorials.
Is there a possibility for me to include that controller inside the div on the portal without having to link to a whole new page for logging in?
I don't know if it's common to use controllers for a login page like this and if there is a better way to do it, I'd be glad to hear it.

Kind regards
#2

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter forums!

I'm not sure I fully understand your question. A controller is the only way to process a login, as the controller is the only part of your application's API that is accessible from the outside.

You can put your login HTML on any pages you choose and have the form submit to your login controller, you just need to ensure that your login controller knows where to redirect to when the login has been processed successfully. You can do this by adding a hidden input to your login form.
#3

[eluser]Mackstar[/eluser]
From what I am guessing you only want to have the login form part added to your main page.

In which case you can import the login page view into your main page with out using the login pages controller.

Do this by using

<?=$this->load->view('/login/index')?>

kind of include, make sure this doesn't have headers and footers that would double up important html tags...
#4

[eluser]roflskater[/eluser]
First of all thank you for your time!
I'm sorry for my confusing explanation, I'm still having some difficulties with the english language =). Anyways, like the last post stated I want my login_view included into my main page like that, but the login form has a hidden field called challenge which holds a variable declared by a method withing the login controller. I could include the code in my view. This would be against the MVC model. I could also copy this method to the mainpage controller, but I'd rather not.
Is there another way to do this?
#5

[eluser]Mackstar[/eluser]
You can put the function in the model and pull it in to both controllers.?? I think this would be closer to the pure MVC model?

Cheers

Richard
#6

[eluser]roflskater[/eluser]
That would be a solution indeed, but aren't models for scripts involving databases?
#7

[eluser]Mackstar[/eluser]
Models are the building blocks for object usage, that usually involves databases, but not always.

It sounds like the login process could very well be built into a object which would be the correct usage of a model??

Cheers

Richard




Theme © iAndrew 2016 - Forum software by © MyBB