Welcome Guest, Not a member yet? Register   Sign In
problems following CI tutorial - pls help
#1

[eluser]ICEcoffee[/eluser]
I am following the 2nd CI video tutorial, and I'm not sure if I have things set properly. Despite following tutorial, I can't get the scaffolding page loaded. It may be something to do with the fact, I am have PHP5 configured on my localhost Xampp server? or some other entry. I tried useing a PHP4 then changing to a PHP5 construct in my default controller, but I get any errors, nor do I see the scaffolding page.

This is what I have:

default controller:
Code:
<?php
class Home extends Controller{
/*
    function Home() {
        parent::Controller();
        $this->load->scaffolding('articles');

    }
*/

    function _construct() {
        parent::_construct();
        $this->load->scaffolding('articles');
    }

    function index(){
         $this->load->view('home_view.html');
echo "this is a test from the home controller";
    }

}
?>

routes.php:

$route['default_controller'] = "home";
$route['scaffolding_trigger'] = "build";


Default view:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html&gt;
    &lt;head&gt;
            &lt;title&gt;my title&lt;/title&gt;
        &lt;link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8" /&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;!-- Layout --&gt;
        <div id="wrapper">
            <div id="header">
                header
            </div>
            <div id="b_crumb">
                Bread Crumbs
            </div>
            <div id="container">
                <div id="center">
                    &lt;?php print "content" ?&gt;
                          content
                          &lt;?php echo " - - this is a test fron the view controller"; ?&gt;
                    <div id="footer">
                        &lt;?php print "footer" ?&gt;
                                footer
                    </div>
                </div>
                &lt;!-- /#center --&gt;
                <div id="sidebar-right" class="sidebar">
                    &lt;?php print "right sidebar" ?&gt;
                          sidebar
                </div>
                <span class="clear"></span>
            </div>
            &lt;!-- /container --&gt;<span class="clear"></span>
        </div>
        &lt;!-- /layout --&gt;
    &lt;/body&gt;
&lt;/html&gt;

autoload.php
Code:
$autoload['libraries'] = array('database');

config.php:
Code:
$config['base_url']    = "http://localhost/mic/";
$config['index_page'] = "index.php";

The database.php has been checked for correct db info.


I don't think I've left anything out, except to say, that as you can see, I put some simple echo statements in the default controller and view files and the show up when pointing my browser to http://loacalhost/mic/ and the CSS file get loaded too with images.

I can't figure out where I have gone wrong. Can anybody help pls?
#2

[eluser]Thoer[/eluser]
It's definietly not xampp and the default constructor function should work in php5 and php4 as well. you forgot to mention whether you see an empty page or not, and if so, you should take a look at the error handling defined in your index.php
At first glance
Code:
$this->load->view('home_view.html');
seems to be invalid as it should be a php file and you don't want to put ".html" when calling your view file.




Theme © iAndrew 2016 - Forum software by © MyBB