CodeIgniter Forums
CI4 Function / Class Names - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forum-31.html)
+--- Thread: CI4 Function / Class Names (/thread-64922.html)



CI4 Function / Class Names - albertleao - 04-11-2016

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:
load_view('path_to_view'); 


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.


RE: CI4 Function / Class Names - Avenirer - 04-12-2016

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


RE: CI4 Function / Class Names - kilishan - 04-12-2016

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