ElkArte Community

Elk Development => Feature Discussion => Topic started by: emanuele on October 30, 2013, 09:53:48 am

Title: Conventions
Post by: emanuele on October 30, 2013, 09:53:48 am
Well, the subject is a bit general, though I have almost only one example in mind at the time, so I'll obviously ask about that, if you have more/others feel free to add.

createList and the callbacks to count/list things.
At the moment we do that in two (main, because I think there are more) different ways:
1) have a list_something and list_[num|count]something in the controller that are in fact wrapper for a function in a subs files,
2) directly call the function in the subs file (including the file using createList or just before that).

So, what's our "favourite" approach?
Title: Re: Conventions
Post by: Spuds on October 30, 2013, 10:52:27 am
From what I've been told

Code: [Select]
            'get_items' => array(
                'function' => array($this, 'list_loadSomeCount'),
then

Code: [Select]
	public function list_loadSomeCount($all, $type)
{
   return countSomeCount($all, $type);
}


Is the preferred way, yeah that first call can simply be the old 'function' => countSomeCount() as well but its less flexible.
Title: Re: Conventions
Post by: emanuele on November 01, 2013, 04:45:51 pm
Good! :D

/me wonders how many should be rewritten then. O:-)