newbie problems with codeigniter

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-03-18T13:31:30Z Indexed on 2010/03/18 13:41 UTC
Read the original article Hit count: 275

Filed under:

hi, i'm trying to learn codeigniter (following a book) but don't understand why the web page comes out empty.

my controller is

class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();
    }

    function index()
    { 
        $data['title'] = "Welcome to Claudia's Kids";
        $data['navlist'] = $this->MCats->getCategoriesNav();
        $data['mainf'] = $this->MProducts->getMainFeature();
        $skip = $data['mainf']['id'];
        $data['sidef'] = $this->MProducts->getRandomProducts(3, $skip);
        $data['main'] = "home";     
        $this->load->vars($data);
        $this->load->view('template');
    }

the view is:

<--doctype declaration etc etc.. -->
</head>
<body>
    <div id="wrapper">
        <div id="header">
            <?php $this->load->view('header');?>
        </div>

        <div id='nav'>
            <?php $this->load->view('navigation');?>
        </div>

        <div id="main">
            <?php $this->load->view($main);?>
        </div>

        <div id="footer">
            <?php $this->load->view('footer');?>
        </div>

    </div>
</body>
</html>

Now I know the model is passing back the right variables, but the page appears completely blank. I would expect at least to see an error, or the basic html structure, but the page is just empty. Moreover, the controller doesn't work even if I modify it as follows:

function index()
{ 
    echo "hello.";
}

What am I doing wrong? Everything was working until I made some changes to the model - but even if I delete all those new changes, the page is still blank.. i'm really confused!

thanks, P.

© Stack Overflow or respective owner

Related posts about codeigniter