CodeIgniter Forums
Hello World problem for beginner - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Hello World problem for beginner (/showthread.php?tid=8799)

Pages: 1 2


Hello World problem for beginner - El Forum - 06-01-2008

[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/";


Hello World problem for beginner - El Forum - 06-01-2008

[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.


Hello World problem for beginner - El Forum - 06-01-2008

[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/method/param1/param2/....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>



Hello World problem for beginner - El Forum - 06-01-2008

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

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