Welcome Guest, Not a member yet? Register   Sign In
Query Builder need help
#6

(This post was last modified: 04-14-2021, 10:00 AM by zdarin.)

(04-13-2021, 02:52 AM)kenjis Wrote: I recommend you read the User Guide:
https://codeigniter4.github.io/CodeIgnit...your-model

Thanks for good way

i made by this and its working, one view but multiple way to get data

PHP Code:
    public function index($page 'page')
    {
        
        $contactcard_model 
= new ContactCard();
        $allcontactcard['contactcard'] = $contactcard_model->getAllContactCards();
        $contactcard['contactcard'] = $contactcard_model->find([2]);

        if ( ! is_file(APPPATH.'/Views/pages/'.$page.'.php'))
        {
            // Whoops, we don't have a page for that!
            throw new \CodeIgniter\Exceptions\PageNotFoundException($page);
        }

        $data 
        [
            'title' => $page,  
               
            
'contactcard'  => view('pages/contacts/contact_card'$contactcard),
            'allcontactcard' => view('pages/contacts/contact_card'$allcontactcard),

        ];  
         

        
echo view('pages/'.$page$data);

    
Reply


Messages In This Thread
Query Builder need help - by zdarin - 04-12-2021, 02:57 AM
RE: Query Builder need help - by kenjis - 04-12-2021, 10:34 PM
RE: Query Builder need help - by zdarin - 04-12-2021, 11:27 PM
RE: Query Builder need help - by InsiteFX - 04-13-2021, 01:40 AM
RE: Query Builder need help - by kenjis - 04-13-2021, 02:52 AM
RE: Query Builder need help - by zdarin - 04-14-2021, 09:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB