Welcome Guest, Not a member yet? Register   Sign In
The real explanation about components
#1

[eluser]Roni Peterson[/eluser]
Yesterday I posted a question and I believe failed to explain the right way, or in the right place, because I got no comment.

I'll try to explain better my problem. The scenario is a login box will be available in multiple views, each of these views has its respective controller. My idea of code reuse was not the actions of the login box at all drivers of the views that contain the login box.

These actions would be the User ID in an attempt to login I forgot my password and through the success User login to change the view, the action off for example.

I'm naming the views as follows, the pages containing the login box and all the html of the page are called views and views with the html of the login box call MicroView.

Could anyone help me with this idea? I am complicating something that is simple in the framework? Please help me to understand that the best way.

Thank you all.
#2

[eluser]Roni Peterson[/eluser]
To make it clear the idea, I am developing a prototype of what I'm thinking.

In this project I have two views with their controllers (view_1 / controller_1 and view_2 / controller_2) and the two views are using a MicroView (microview_1 / microview_controller_1) since the login box will appear on every page. So far I have the code and logic properly separated, not duplicated and reused ... but now I need to load the controller of view_1 or view_2, depending on what was the view that triggered the implementation of microview_controller_1.

Any suggestions?

Thank you all.


The code can be downloade here
#3

[eluser]Roni Peterson[/eluser]
Ok, I managed to close the logic of the idea ... if someone wants an opinion, feel free to share.

Here the final code.
#4

[eluser]Roni Peterson[/eluser]
Concluded that all I did not disagree with the proposal of the MVC. I solved the problem simply by using the control methods that I return previews and then do AJAX calls to load the common areas ... I removed the codes that have been released in previous posts, tomorrow but one example of the solution.




Theme © iAndrew 2016 - Forum software by © MyBB