Welcome Guest, Not a member yet? Register   Sign In
load() method doesn't work
#1

Hello there,

since 1 week i started to get into the whole MVC World. And because my understanding of it equals null i was unsuccessful with CakePHP, Symfony or Laravel. Then i found the Codeigniter.

I was experimenting with Routing and AJAX and Controllers and now i want to make myself a template in the Views folder. I tried to include the so called header.php and footer.php in my home.php page but i doesn't work. After some research i found out that in Codeigniter you can't just do an include like in conventional php. 

After another research i found a way to do it but my Codeigniter seems to not recognize the method i am using although for everyone else works without for them to do anything.
My Code looks like this:

PHP Code:
<?php namespace App\Controllers;


class 
Home extends BaseController
{

    public function 
index()
    {
        
$pageData = [

            
'header' => $this->load->view('header.php'NULLTRUE),
            
'footer' => $this->load->view('footer.php'NULLTRUE),
            
'tabTitle' => 'Online Shop MTFKS!'
        
];

        return 
view('home.php'$pageData);
    }

    
//--------------------------------------------------------------------



This call $this->load seems not to be existent. My PHPStorm throws me an error everytime i click on it.


[Image: jSNcdf0.png]

I am stuck and i don't know how can i go further.

I have to mention that when i installed the Codeigniter Framework i just downloaded it and extracted it in my project folder as mentioned in the Docs. Then i followed the docs to finish setting it up. But somehow i think something is missing. And whenever i try to install it composer it just doesn't run, my powershell is stuck on an empty line.

When i run this code my website just gives me the standard CI Whoops! Error.

Thank you !
Reply


Messages In This Thread
load() method doesn't work - by blaudroid - 01-08-2020, 02:51 AM
RE: load() method doesn't work - by maxxd - 01-08-2020, 06:45 PM
RE: load() method doesn't work - by InsiteFX - 01-09-2020, 04:07 AM
RE: load() method doesn't work - by blaudroid - 01-09-2020, 06:09 AM
RE: load() method doesn't work - by kilishan - 01-09-2020, 07:29 AM
RE: load() method doesn't work - by littlej - 01-10-2020, 10:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB