Welcome Guest, Not a member yet? Register   Sign In
CI's Library and Helper Basics
#1

[eluser]Fielder[/eluser]
So I followed and learned quite a bit, from scratch, going over the CI video tutorials. And the way that tutorial was done seemed to only scratch the surface of CI's capabilities, but was a good starting point for me. I'm new to MVC and OOP, but would like some pointers on what libraries really are, and how I can use them to really utilize CI flexability.
When would I want to use helpers vs. libraries?
What about a custom config file. Can I define paths and other regularly used variables in the config file, then somehow call them throughout the application?

Ive read through quite a bit of code that has been posted just learning how other more experienced programmers structure it. I see a lot of $this->load-library() and $this->load->view($this->xxxx->yyyy, $data). So in this example from what I gather the load->view is going into a function (called yyyy) inside the loaded library (xxxx) to run.

Seems like I've seen some code with people "building" views then outputting them. Is that a good practice?

I don't mind spending time reading the wiki and manuals.. and will probably spend some time this evening just trying to grasp the concept. Any other good walk-throughs for moderate or more advanced coding techniques out there?

Thx.
#2

[eluser]Sumon[/eluser]
i am not good one in CI. but from my experience, it's easy but powerful MVC framework. let's share our experience.
First of all you are totally right. User guide is really good starting point.
Difference between library and helper: we can call helper functions directly from anywhere(specially from view) in CI.libraries are useful to implement OOP and re usability of code.
Yes sometimes we create custom config(file inside application/config/)and call them throughout the application.
Next about view i don't understand your question clearly because i am not good in english reading Wink But i feel, this is the way by which we can implement master page concept. lets share some code
Code:
$data['content'] = 'auth/form_registration_view';
$this->load->view('layout/logged_view', $data);
here logged_view is the master template. to give you and idea, master template=header, left menu, footer.
And finally, in my opinion, we all need to start reading CI user guide with full of patience. user guide is really really helpful one.
Fielder: don't think that, i am an expert. but what i try to do is share some thought with you. i might be wrong at some points. but i am sure you will catch up those and move forward easily.

Welcome to Code Igniter World.




Theme © iAndrew 2016 - Forum software by © MyBB