Welcome Guest, Not a member yet? Register   Sign In
Hello World problem for beginner
#11

[eluser]Rabbi[/eluser]
Yes. I tried all possible ways.

$config['base_url'] = "http://localhost/ci/";

$config['base_url'] = "http://localhost/";

$config['base_url'] = "http://127.0.0.1/ci/";

$config['base_url'] = "http://127.0.0.1/";
#12

[eluser]xwero[/eluser]
Rabbi the path should have all forward slashed, this means the str_replace function isn't doing it's work. The problem is the framework relies ot the unix style separators to prevent the use of the DIRECTORY_SEPARATOR constant otherwise if you want to call a view in a subdirectory for instance you would have to do
Code:
$this->load->view('directory'.DIRECTORY_SEPARATOR.'viewfile');
instead of the str_replace function you could try the preg_replace_all function but that is slower.
#13

[eluser]Rabbi[/eluser]
At last, i solved it. :-)

Everything is OK in CodeIgniter.
But some tutorials or user_guide isn't showing everything correct for Windows user. This is not fair!

The following thread help me 50%.
http://ellislab.com/forums/viewthread/80402/

The correct link is: (for those who are using php on Windows)
http://localhost/ci/index.php?hello/index/Bangladesh

Generic format for the windows user is:
http://localhost/ci/index.php?controller...m2/....etc

where, ci="CodeIgniter"....folder's name.

Controller's Code:
Code:
<?php
class Hello extends Controller{
    function Hello(){
        parent::Controller();
    }
    function index($name) {  
        $data['name'] = $name;  
        $this->load->view('show_name',$data);
    }
}
?>

View's Code:
Code:
<html>
    <body>
        Hello, <?=$name?>!
    </body>
</html>
#14

[eluser]Seppo[/eluser]
I run Windows and I use http://localhost/ci/index.php/controller...m1/param2/

Usually IIS has issues with that, but.. well... IIS sucks




Theme © iAndrew 2016 - Forum software by © MyBB