Welcome Guest, Not a member yet? Register   Sign In
HMVC - How to prevent scan directories for resource files ?


Is there a way to load resource file without scanning directories ? I mean I need to exactly specify path for resource,

e.g. If I try to load : $this->load->view('myview') from controller
HMVC scans for several files in several locations:




This is Ok for small applications but not if you write code for web with 120.000 uniques/day.

I checked modules_find function in modules_helper.php and seems that it's impossible without changing the code.

Is there a way to overcome this ?

Thank you...

If you use Modules properly and don't try to cross load resources then ME will find your files on the first try. And there is no issue.

If you are building a site for 120,000 uniques, some thought about application design is advisable.

Thanx wiredesignz unfortunately there are still 2 x access to file system..
First for is_file($path2.$name) and next when the file is included into code. It would be great to add some parameter that will prevent to scan with is_file and will just include exact file with full path specified.

You can always simply include the required file directly, without using $this->load, if it becomes an issue.

I looked more in code and "echoed" some things from module_find function...

Is file ? application/modules/welcome/views/myview.php

Is file ? application/modules/welcome/views/Myview.php

Is file ? application/views/myview.php



This is what makes things a bit slower... two checks for same file (one first char upper case the lowercase).

Also as you can see in my example I need to share some views for various modules so I want to put them in application/views/ directory (to be good organized), but if I cannot specify the exact path when I load this view it tries to find 3 files and makes 3 x is_file(....)

Any advice ?

[quote author="wiredesignz" date="1216416202"]You can always simply include the required file directly, without using $this->load, if it becomes an issue.[/quote]

Can you send me some example please ?

I'm bit confused now because e.g. views are not just included but there is some pre-processing included first ... I mean e.g. when I add data to view $this->load->view('viewname',$data); I cannot simply replace this with include('viewname.php');

You wouldn't include views obviously, but libraries, plugins, helpers, controllers could all be loaded manually if needed.

I would be happy to consider any improvements to the file loader if you are prepared to offer some code examples.

Hi ckissi,

I'm also working on a portal and planning to use CI for a website on which expected unique visitors will hit around 200,000.

Do you recommend CI + HMVC ?

What are the best practice tips. Thanks in advance for help!

Theme © iAndrew 2016 - Forum software by © MyBB