Welcome Guest, Not a member yet? Register   Sign In
Preventing DRY in OOP
#9

[eluser]InsiteFX[/eluser]
Move them to the Base_Controller

Code:
public static $page_data = array();

public function __construct()
{
    parent::__construct();

    $this->set_page_data();
}

public function set_page_data()
{
    // you may need to add code to get this stuff!
    if (empty($page_data)
    {
        $page_data['page_title'] = "My Account - ";
        $page_data['ad_without_photo_found']=$this->ad_without_photo_found;
        $page_data['unread'] = $this->unread;
        $page_data['logged_user']=$this->logged_user;
        $page_data['my_haves'] = $this->my_haves;
        $page_data['need_membership'] = $this->need_membership;
        $page_data['notifications'] = $this->notifications;
        $page_data['show_contact_details'] = $this->show_contact_details;
        $page_data['update_message']='';
        $page_data['need_membership'] = $this->need_membership;
        $page_data['unread_menu_message'] = $this->unread_menu_message;
    }
}

public function get_page_data()
{
    // when you retrieve the $page_data you could array_merge it with $data
    return $this->$page_data;
}


Messages In This Thread
Preventing DRY in OOP - by El Forum - 01-09-2014, 05:44 AM
Preventing DRY in OOP - by El Forum - 01-09-2014, 10:01 AM
Preventing DRY in OOP - by El Forum - 01-09-2014, 10:33 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 01:41 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 05:22 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 10:11 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 02:12 PM
Preventing DRY in OOP - by El Forum - 01-11-2014, 05:12 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 05:44 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 05:54 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:09 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:10 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:13 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:17 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:29 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:33 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 07:49 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 07:51 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 07:54 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 09:16 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 09:58 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:09 PM
Preventing DRY in OOP - by El Forum - 01-12-2014, 05:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB