Welcome Guest, Not a member yet? Register   Sign In
Modular Extensions - Version 4.3

[eluser]codex[/eluser]
[quote author="wiredesignz" date="1215746900"]Why do you say IT should be looking, Really your view file should be placed in the scan path.

I assume cms_dashboard is your controller name? located in your cms module? So where does dashboard come in? and how do you expect ME to find the file when there is no reference to dashboard anywhere?

Try prefix segment like: $this->load->view('cms/dashboard/dashboard_view');

You do like to make life difficult for yourself. Wink[/quote]

I understand what you're saying, but what I meant was that I expected if I explicitly set the path, ie: application/modules/cms/views/dashboard/dashboard_view.php, this would overrule the scan path and look directly into the given path. Yes, maybe I make things more difficult than they have to be, but I think apps should give me the freedom to do what I want, and not make me do what the app wants. By saying 'stuff has to be in the scan path' I think you lose flexibility.

[eluser]wiredesignz[/eluser]
The idea is to structure your application logically, modules ARE organizational entities, and sub-directories are sub-organizational.

Modular Extensions is fast because you have to follow a few rules, and remember every empty path it scans takes more time.

Think of this as name_spacing your files rather than restricting flexibility.

I could also mention that other frameworks are even more restrictive on file location and naming.

[eluser]codex[/eluser]
[quote author="wiredesignz" date="1215747897"]
I could also mention that other frameworks are even more restrictive on file location and naming.[/quote]

I don't have any experience with other frameworks so I wouldn't know.

Basically the way I think the localization of file should be:

Code:
Look into the explicitly given path

> if given is not a path or file is not found, look into the module

> if file is not found in the module, or module doesn't exist, look into application folder

> if file is not found, return error


Does this sound logical?

[eluser]wiredesignz[/eluser]
@codex, If you want to code this up, I will consider adding it to ME.

[eluser]codex[/eluser]
[quote author="wiredesignz" date="1215748925"]@codex, If you want to code this up, I will consider adding it to ME.[/quote]

That's like asking a monkey to fix your computer.


But hey, I'll give it a go. Now let's see how Zacharias did this ;-)

[eluser]a&w[/eluser]
Argh. I thought I was starting to understand what you were saying about the containment of the module. So I was thinking about something like this:
Code:
L system (CI Core goes here)
   L libraries (CI Core libraries)
L application1
   L libraries
      L mySharedApp1Library
L application2
   L libraries
      L mySharedApp2Library
L modules
   L module1
   ...
   L module4
      L controllers
          controller4 (accessor / entry point / manager)

      L methods
          method4
      L helpers
          helper4
      L models
          model4
      L views
      L libraries
         module4Class1
         module4Class2
So, just for example, I was thinking that controller4 might need helper4. Since we're within a module, I took it that you're saying to not bother using CI to get to that helper, so do NOT use CI->load->helper('helper4'), but instead to do require_once. Problem with that, I hate to admit, is that I'm failing miserably trying to do include that file (how do I point to that location?).
Ugh, maybe I should just return to matchbox. = (

[eluser]wiredesignz[/eluser]
@a&w, A module controller has access to its own files. $this->load->helper('helper4') is the correct way to load from controller4 in module4.

I never said to use include or require to replace CI Loader in modules. Please read my post about loading library dependencies in the ME5 topic.

[eluser]sophistry[/eluser]
after a few months of looking, i am finally testing this code and i hit a snag:

I followed the quickstart guide (fresh install of CI, welcome message working, then drop in ME 4201 files (2 application/helpers, 2 application/libraries) and i get this error when i try to get to the welcome controller:
Code:
Fatal error: Call to a member function on a non-object in /path/to/system/application/libraries/Controller.php on line 91

the code at line 91:
Code:
$this->loader->_ci_autoloader();

i am on CI 163, php4, mac osx.

it seems like maybe the load_class() common function is being called multiple times and loses the reference to the object at some point, but i am in unfamiliar territory here in the Loader class and bootstrap process...

any quick answers? or do i need to dig deeper and provide some more context and debugging dumps?

thanks!

[eluser]wiredesignz[/eluser]
Hi sophistry,

I have recently updated the wiki with Modular Extensions version 4.2.02, but I will need to check this out for you.

Unfortunately I don't have a PHP4 installation handy to test on, so any info you can give will help.

EDIT:
I think I have made a mistake while bringing ME4.2 up to spec with ME5.0,
CI pre-loads the CI_Loader class before the Controller is instantiated.
This is why we get that error, after trying to reload the CI_Loader a second time.

Could you try adding this at Controller.php - line 21
Code:
/* load the CI_Loader class */
require_once BASEPATH.'libraries/Loader.php';

And altering Controller.php - line 75
Code:
/* create CI_Loader instance */
$this->loader =& new CI_Loader();

Let us know what results you get.
All going well I will update the wiki with these changes.

[eluser]wiredesignz[/eluser]
Wiki is updated, Modular Extensions 4.2.03 bugfix is now available. Thanks sophistry. Wink




Theme © iAndrew 2016 - Forum software by © MyBB