Welcome Guest, Not a member yet? Register   Sign In
How the extension of the core classes works and where exactly's being done?
#1

[eluser]Unknown[/eluser]
Hello. I am currently developing a CMS (ignitioncms.net/installation/ for a install demo) and I am using Modular Extensions - HMVC and Phil Sturgeon's Template library. I want to seperate the front and back end with an administration folder (just like in Joomla!) in which the administration related templates, modules, helpers and libraries to be held. I am aming for an approach that uses CI's & HMVC's core methods such as Loader::view(), Loader::module(), Loader::helper() and so forth for logic implementation and to be sophisticated enough to understand where to search for a given module in the application or in the administration folder. In addition, when somebody wants to reach the admin folder with the 1-st segment of an URL, the URI segments have to be processed and something as array-pop to be implmeneted but to cut the 'administration' from segment(1) and to put segment(2) on its place instead and so on. I thougt a lot about an appropriate implementation and stated that I need another Admin Loader and Controller classes (and stored in e.g administration/core_override ) which extend the core classes when someone's trying to access the administration. Otherwise, the core classess should be used. The problem is that it's kinda complex to figure how everything works in the core files. I see that in the Codeigniter.php file on about 237 line the MY_Controller is called. How can I implement functionality that checks the URI with the URI class for 'administration' in segment(1) and if there is - to extend with the APPPATH.'administration/override/(Controller/Loader).php' file and extend with the MY_ one if there isn't? I'd also like to ask how the extension of the core classes work. E.g where the code for the URI extensions in being called? And how this affects the CI's super object? In Codeigniter.php file on 237 line I see that the MY_classes are being required. How exactly does that affect the system? Don't they have to be instantiated first and replace the core Controller in the CI object? I also cannot see e.g where MY_URI or MY_Loader are being called(and instanciated?). Why only by requiring the classess everything is being carried out?
#2

[eluser]Unknown[/eluser]
Could somebody at least help me to find where are being instanciated the extensions(the MY_ classes) of the Core CI classes?
#3

[eluser]InsiteFX[/eluser]
I posted this before but will post it again here!
Code:
/**
* CodeIgniter Loading sequence.
*
* So if you are having problems check out these loading sequences!
*
*/

1)  index.php - Sets up the paths and loads .system/core/codeigniter.php
2)  Loads Codeigniter.php - .system/core/codeigniter.php - loading sequeces.

1)  Loads the CI framework constants - .system/core/Common.php
2)  Defines a custom error handler so it can log PHP errors
3)  Sets up the subclass_prefix
4)  Sets a liberal script execution time limit.
5)  Starts the benchmark timer.
6)  Instantiates the hooks class - .system/core/Hooks.php
7)  Checks for a "pre_system" hook?
8)  Instantiate the config class. - .system/core/Config.php
9)  Instantiate the UTF-8 class. - .system/core/Utf8.php
10) Instantiate the URI class. - .system/core/URI.php
11) Instantiate the routing class and set the routing. - .system/core/Router.php
12) Instantiate the output class. - .system/core/Output.php
13) Checks for a valid cache file?
14) Loads the security class for xss and csrf support. - .system/core/Security.php
15) Loads the Input class and sanitize globals. - .system/core/Input.php
16) Loads the Language class. .system/core/Lang.php
17) Loads the app controller and local controller. - .system/core/Controller.php
18) Checks for a "pre_controller" hook?
19) Instantiate the requested controller and assigns the CI object Class.
20) Checks for a "post_controller_constructor" hook?
21) Call the requested method and checks for _remap
22) Checks for a "post_controller" hook?
23) Sends the final rendered output to the browser.
24) Checks for a "post_system" hook?
25) Closes the DB connection if one exists.

Hope this helps...
#4

[eluser]Aken[/eluser]
In the future, you may want to structure your questions to be less wordy, or at least easier to read. People aren't eager to help someone when they have to read a giant paragraph of text first.
#5

[eluser]PhilTem[/eluser]
To be honest: I don't understand how you are able to develop a CMS without knowledge of the system in use. I have the impression that you didn't fully understand, how the business logic and the workflow in CI really works and now you want to make something in a more complex way than you would have had to if you did it correct from the beginning.

See, I don't want to make you down, but I am developing a sort-of CMS based on CI, too, but before I write a lot of lines I have thoughts on how I want everything to work and I then I read into the CI files to see where I can extend what class or where there's space to hook my code into the core code.

But nonetheless, I think that @InsiteFX's post is a good point for you to get started and maybe rethink your current code Wink




Theme © iAndrew 2016 - Forum software by © MyBB