Welcome Guest, Not a member yet? Register   Sign In
Unable to load the requested file error
#6

[eluser]TheFuzzy0ne[/eluser]
You can always just read the code, and see for yourself exactly what the code is doing, then you can try to figure out why.

I don't know off-hand, but since we have a directory for controllers and directory for models, I guess it made sense to also have one for views (since this is an MVC framework). Since that's where you're expected to put you views, that's where CodeIgniter looks for them. Views are usually stored on the local filesystem, so there's no need to support URL file paths.

Also, views are include()d, and the output is buffered. As the file is loaded, it's parsed by the PHP parser, so variables and any other PHP code will be evaluated and executed too.

I suspect you assumed that it would just use file_get_contents() or fopen(), and thus allow you to use a URL as a filename, but since the file is include()d, and include() doesn't support URLs, the view loading method first checks to see if the file exists where it expects to find it before include()ing it.

If you did want to load external content, you can simply use file_get_contents($url) (which won't be parsed by the PHP parser), and then pass that into a view, but I doubt you'd ever need to do that.

Hope this helps.


Messages In This Thread
Unable to load the requested file error - by El Forum - 05-30-2013, 04:16 AM
Unable to load the requested file error - by El Forum - 05-30-2013, 04:25 AM
Unable to load the requested file error - by El Forum - 05-30-2013, 04:28 AM
Unable to load the requested file error - by El Forum - 05-30-2013, 09:57 AM
Unable to load the requested file error - by El Forum - 05-30-2013, 11:18 AM
Unable to load the requested file error - by El Forum - 05-30-2013, 02:21 PM
Unable to load the requested file error - by El Forum - 05-31-2013, 05:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB