Welcome Guest, Not a member yet? Register   Sign In
Search Results
    Thread: Move code from controller to helpers/models
Post: Move code from controller to helpers/models

Hi, I am building on My_Controller.php a object based on some config variables: PHP Code: -- protected $config_columns = array('product_name', array('category' => 'category_name', 're...
2,525 Views
1 Replies
01-26-2016, 01:44 AM
sebastianvirlan
    Thread: Loop through multiple array concat and sort by value
Post: Loop through multiple array concat and sort by val...

I have a array that describe a database table and it's relations. Assume we have a products table with following fields: product_id column1 column2 column_three and based on the table I create a o...
2,442 Views
1 Replies
01-06-2016, 02:51 PM
sebastianvirlan
    Thread: Real estate Database
Post: RE: Real estate Database

sintakonte Wrote: (11-09-2015, 04:41 AM) -- i think this table names are not really intuitive especially with your illustration i would prefer your first attempt because we don't have to much to fix ...
9,952 Views
5 Replies
12-07-2015, 07:24 AM
sebastianvirlan
    Thread: Get image url from model good practice?
Post: RE: Get image url from model good practice?

sintakonte Wrote: (11-12-2015, 03:41 AM) -- the autoloader only loads files from the application/objects directory if the proprietati_model was inside of this directory than remove it and copy it to...
18,005 Views
18 Replies
11-12-2015, 03:49 AM
sebastianvirlan
    Thread: Get image url from model good practice?
Post: RE: Get image url from model good practice?

This should fix it cuz I return the view as data: PHP Code: --    public function get_block_caracteristics(){        if($this->nume_tip_proprietate == 'apartament')            return $this-...
18,005 Views
18 Replies
11-12-2015, 03:08 AM
sebastianvirlan
    Thread: Get image url from model good practice?
Post: RE: Get image url from model good practice?

Ok so I used your idea and merged to create custom objects on another projects, here is the code and please tell me if is ok: hooks.php PHP Code: -- $hook['pre_system'][] = array(    'class...
18,005 Views
18 Replies
11-11-2015, 06:23 AM
sebastianvirlan
    Thread: Get image url from model good practice?
Post: RE: Get image url from model good practice?

dubefx Wrote: (11-10-2015, 02:07 PM) -- @sintakonte very interesting aproach, i learned something new today, so thanks. But CI3 already have this functionality custom_result_object and custom_row_obj...
18,005 Views
18 Replies
11-11-2015, 01:00 AM
sebastianvirlan
    Thread: Handle object in class helper - Best practice
Post: RE: Handle object in class helper - Best practice

Or I can use query cache, and on every ADD/DELETE delete cache and rebuild.
6,674 Views
7 Replies
11-11-2015, 12:39 AM
sebastianvirlan
    Thread: Handle object in class helper - Best practice
Post: RE: Handle object in class helper - Best practice

I was thinking, wouldn't be more practice if I join the categories table with products and count the products? And no more foreach and count method needed. EDIT This was the best solution: PHP Cod...
6,674 Views
7 Replies
11-10-2015, 07:56 AM
sebastianvirlan
    Thread: Get image url from model good practice?
Post: RE: Get image url from model good practice?

Yes my Model used the foreach and because of this I posted ... Yes, sometimes I have result and sometimes row with 1 result.
18,005 Views
18 Replies
11-10-2015, 06:27 AM
sebastianvirlan
    Thread: Get image url from model good practice?
Post: RE: Get image url from model good practice?

I am not very convinced about this method because I must do a foreach in models. And let me tell you why: in Products model I may have: select_by_id select_by_slug select_by_category_id_by_lim...
18,005 Views
18 Replies
11-10-2015, 05:39 AM
sebastianvirlan
    Thread: Handle object in class helper - Best practice
Post: RE: Handle object in class helper - Best practice

Like you told me in this post http://forum.codeigniter.com/thread-63496.html ?
6,674 Views
7 Replies
11-10-2015, 05:07 AM
sebastianvirlan
    Thread: Handle object in class helper - Best practice
Post: RE: Handle object in class helper - Best practice

Avenirer Wrote: (11-10-2015, 03:48 AM) -- Why not transform it into a library? -- Can you tell me the difference? Advantages?
6,674 Views
7 Replies
11-10-2015, 03:55 AM
sebastianvirlan
    Thread: Handle object in class helper - Best practice
Post: Handle object in class helper - Best practice

I made this class for categories: PHP Code: -- class Categories {    private $_category;    private $_ci;    public function __construct($category){        $this->_ci = get_instance();     ...
6,674 Views
7 Replies
11-10-2015, 02:16 AM
sebastianvirlan
    Thread: Get image url from model good practice?
Post: RE: Get image url from model good practice?

Martin7483 Wrote: (11-10-2015, 01:16 AM) -- In the world of MVC each request is routed to a Controller. You could ignore the M and V completely and do everything in your controller. But you will quic...
18,005 Views
18 Replies
11-10-2015, 01:45 AM
sebastianvirlan
    Thread: Get image url from model good practice?
Post: RE: Get image url from model good practice?

I think a good start would be OOP, so I started: PHP Code: -- class Product { private $_product; private $_resolution; public function __construct($product, $resolution){ ...
18,005 Views
18 Replies
11-10-2015, 12:39 AM
sebastianvirlan
    Thread: Real estate Database
Post: RE: Real estate Database

@PaulD. I said in title that the database is a Real Estate one. So the table names are pretty intuitive. proprietati -> proprietes zone -> zone strazi -> streets proprietari -> owners agents ->...
9,952 Views
5 Replies
11-09-2015, 12:47 AM
sebastianvirlan
    Thread: Get image url from model good practice?
Post: Get image url from model good practice?

Is this method a good practice? Controller: PHP Code: -- $produse = $this->produse->entries_by_limit((($page-1) * $config_pagina['per_page']), $config_pagina['per_page'], $order_by, '270'); ...
18,005 Views
18 Replies
11-06-2015, 07:42 AM
sebastianvirlan
    Thread: Real estate Database
Post: Real estate Database

Hi, I am making a real estate website in CI. Witch database should I choose? http://i.stack.imgur.com/MRrFo.png and http://i.stack.imgur.com/YRzdl.png
9,952 Views
5 Replies
11-06-2015, 12:36 AM
sebastianvirlan
    Thread: Code logic in codeigniter
Post: RE: Code logic in codeigniter

Wow mwhitney I would never guessed that I can call a my_controller function by url like controllers from controller folder. Thank you a lot for that tip ! When I start to call some functions from ther...
8,902 Views
8 Replies
08-25-2015, 05:09 PM
sebastianvirlan

Theme © iAndrew 2016 - Forum software by © MyBB