Welcome Guest, Not a member yet? Register   Sign In
CI4 Function / Class Names

(This post was last modified: 04-11-2016, 07:08 PM by albertleao.)

I understand that CI4 is under heavy development and a lot is expected to change, but I was wondering whether or not there is going to be public discussion relating to class and function names in the core.

For example, currently (As of 4/11/2016), the function to generate and return a view is:
PHP Code:

So if you wanted to output a view it would be:
PHP Code:
echo load_view('path_to_view'

But in essence, you're not echoing the loading of a view, you're echoing the view itself so the more correct term would be:
PHP Code:
echo view('path_to_view'

I know this might sound like a small change that won't affect many people at all but I was wondering if there was going to be any public input on things like this.
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!

I never knew that the function to generate and return a view is currently "load_view('path_to_view')"...

It was originally called view, but was changed for 2 reasons. The primary reason was to match up in style with the load_helper function. Second, it really depends on how you look at it. The function itself really just loads the view so that it can be used elsewhere. The echo command is the one displaying it, so it still makes sense with load_view as the name. It could just as easily be stored in a variable, in which case, 'view' doesn't make as much sense.

Once the repo is an official BCIT repo, then I'm sure everyone will have their say on naming of functions, but I wasn't planning on putting them all up for a vote. Smile

Theme © iAndrew 2016 - Forum software by © MyBB