Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


CodeIgniter - where to put functions / classes?


Am having problems understanding where classes should be kept in CI. I am building an application that describes / markets mobile phones.

I would like for all of my functions (i.e. getphone, getdetails etc.) to reside in one class called Mobile - I understand that this file should be called Mobile.php and reside in the controllers folder.

Can I then have multiple functions inside Mobile.php? E.g.

public function getphone() {
   xxx
   xx
   xx
}

public function getdetails() {
   xxx
   xx
   xx
}

Or do I need to put each function in its own class?

I'd really appreciate looking at some sample code that works. I've been going through the documentation and google for a few hours, and tried all sorts of variations in the URL to find a test class, but without much luck! I've even messed around with the routes and .htaccess...


asked Apr 29, 2015 in codeinither by rahulgii
0 votes
18 views



Related Hot Questions



Government Jobs Opening


...