Hello,

I wonder why I see blank screen on CI.

controllers/page.php

<?php

class Page extends CI_Controller {


    public function index()
    {
        $this->load->view('index');
    }
}


?>

views/index.php

<html>

<link href= "<?php echo base_url(); ?>assets/css/style.css" rel="stylesheet" type="text/css" media="screen">

<script src="<?php echo base_url(); ?>assets/js/jquery.min.js" type="text/javascript"></script>
<script src="<?php echo base_url(); ?>assets/js/chili-1.7.pack.js"></script>
<script src="<?php echo base_url(); ?>assets/js/jquery.cycle.all.js" type="text/javascript"></script>
<script src="<?php echo base_url(); ?>assets/js/jquery.easing.1.3.js" type="text/javascript" ></script>

<script type="text/javascript">
$('#slideshow').cycle({ 
    fx:     'fade', 
    speed:   900, 
    timeout: 10000, 
    pager:  '#nav', 
    pagerAnchorBuilder: function(idx, slide) { 
        // return selector string for existing anchor 
        return '#nav li:eq(' + idx + ') a'; 
    } 
});
</script>


<?php include('includes/navigation.php'); ?>

<body>

<div id="slidesnav"><center><img src="<?php echo base_url(); ?>assets/images/slidesnav1.jpg"><img src="<?php echo base_url(); ?>assets/images/slidesnav2.jpg"><img src="<?php echo base_url(); ?>assets/images/slidesnav1.jpg"></center></div>

<div id="demos">
    <div id="slideshow" class="pics">
        <script>$('body').css('background-color', 'blue');</script>
        <script>$('body').css('background-color', 'red');</script>
        <script>$('body').css('background-image', 'url("../images/indonusa3.jpg")');</script>        
    </div>
    <ul id="nav">
        <li><a href="#"></a></li>
        <li><a href="#"></a></li>
        <li><a href="#"></a></li>   
    </ul>
</div>

<?php /*

 <img src="images/indonusa1.jpg" width="950" height="200" />
        <img src="images/indonusa2.jpg" width="950" height="200" />
        <img src="images/indonusa3.jpg" width="950" height="200" />      

*/ ?>       

<div id="products">
<a href="connection.php"><img src="<?php echo base_url(); ?>assets/images/connection.jpg"></a>
<a href="collaboration.php"><img src="<?php echo base_url(); ?>assets/images/collaboration.jpg"></a>
<a href="solution.php"><img src="<?php echo base_url(); ?>assets/images/solution.jpg"></a>
</div>


</body>

<?php include('includes/footer.php'); ?>

</html>

routes.php

$route['default_controller'] = "page";
$route['404_override'] = '';

Thanks.

The code you have given does not seem to have any error.
try using :

ini_set('display_errors', 1);
error_reporting(E_ALL);

see if any error comes...

nothing appears. Still shows me a blank screen.

between these two,

    $route['default_controller'] = "page";
    $route['404_override'] = '';

add $route['page'] = 'page'; like

    ## this where it all begins
    $route['default_controller'] = "page/view";

    ## this will make your page visible
    $route['page'] = 'page';

    ## this will catch anything
    $route['page/(:any)'] = 'page/view/$1';

    ## this will route to 404 for pages that don't exist in page namespace
    $route['404_override'] = '';
  1. use a sample index.php file with a dummy content without any php variable and also try enabling the debug mode to display errors in CI.

  2. Check if the contorller is actually getting the path of the correct view to be rendered.

I thought if I type $route['page'] = 'page'; then I have type: http://localhost/IndonusaCI/index.php/page in the url (even so it's still doesn't work). I only want to type http://localhost/IndonusaCI/ in the url to make it works (run index.php file).

I don't understand : $route['page/(:any)'] = 'page/view/$1';

what's the $1 for ? I thought the syntax is $route['url'] = 'class/method/id' ?

I revise:

controllers/page.php

<?php

class Page extends CI_Controller {


    public function view()
    {
        $this->load->view('index');
    }
}

?>

I input :

routes.php

$route['default_controller'] = 'page/view';
$route['page'] = 'page';
$route['404_override'] = '';

I try :

http://localhost/IndonusaCI/index.php/page --> Page Not Found

http://localhost/IndonusaCI/ --> blank screen

note: IndonusaCI (a rename from CodeIgniter)

The RewriteRule basically means that if the request is done that matches ^(.+)$ (matches any URL except the server root), it will be rewritten as index.php?url=$1 which means a request for olle will be rewritten as index.php?url=olle

http://localhost/IndonusaCI/

for the above to work you need an Index Controller and the correspoding view file.
please confirm you have one and also confirm this works fine with the present rewiting.

Once you have checked that then try creating a route in the route.php for page.

Is the class name has to be = the file name ?

so it will like this?

controllers/index.php

<?php

class Index extends CI_Controller {

    public function index()
    {
        $this->load->view('index');
    }
}


?>

and add:

routes.php

$route['index'] = 'index';

I type this url: http://localhost/IndonusaCI/ ---> blank screen

ok, I just enable query string. Then, what's next?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.