• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Building application structure - problems with controllers?

#9
[eluser]pzajdler[/eluser]
Well, could You elaborate it a bit? Do you mean I should create a controller My_Controller (the one that extends CI_Controller and is autoloaded) that handles ALL requests of my template? Cause this is what it is going to do in this case, since I don't know what "module" of the template is going to be loaded (different view means different modules placed on the template based on the database). I will maybe "draw" it step by step:

Application initializes
Application processes the URL to request right controller
Application loads appropriate controller
Controller processes the request using its methods and its model and takes the template along with data passed to it
Custom parsing library is loaded
Parser parse the template to prepare final page (containing "content" view and "module" views)
Controller displays the page (probably using set_output and other required functions)
Now - how do I handle different "module" controllers? I would like, for example, have there AJAX based module of something, this means it needs ITS controller to: get the request, call its module to process data/gather data, send the reply to the script. Before the template is parsed I don't know what "module" views will be loaded, therefore I don't know which controllers' functionality I may need.

Should everything be put in one controller having ALL the functionality for the whole website, just loading different variants of the template and controlling the whole application?


Messages In This Thread
Building application structure - problems with controllers? - by El Forum - 07-13-2012, 05:24 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.