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]
After this post
http://ellislab.com/forums/viewthread/81081/

I made a file named "blog.php" in application\controllers\blog.php.

Here is my code, which i have written in the file blog.php
Code:
<?php
class Blog extends Controller {

    function index()
    {
        echo 'Hello World!';
    }
}
?>



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

[eluser]RaiNnTeaRs[/eluser]
have you got your database configured out yet ?


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

[eluser]Rabbi[/eluser]
No.
But why should i configure database here? I am not using database.


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

[eluser]RaiNnTeaRs[/eluser]
ow i c ^^.
Maybe you can try adding this lines in your class constructor
parent::Controller();

Hopes that works Big Grin


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

[eluser]xwero[/eluser]
No you don't need to configure a database by default.

Try putting the hello world into a view instead of outputting it and call the view file. That is the way the hello world should function if you want to follow the MVC pattern.

There should be no problem with the controller as it is. I don't see how you get the error message you see on your screen. Are you including an external file somewhere or autoloading a custom library, helper, model or plugin?


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

[eluser]stuffradio[/eluser]
A possible problems is you didn't configure the default controller a

RaiNnTeaRs I was going to agree with you... but he didn't add a constructor so that's not an issue.


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

[eluser]xwero[/eluser]
The default controllers can't be the issue as he is directing to a specific controller.


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

[eluser]stuffradio[/eluser]
What exactly is the error though?


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

[eluser]Rabbi[/eluser]
OK thnx. Sorry for disturbing you guys.

Nothing is working. Btw, i am now debugging the main "index.php".
Code:
if (strpos($system_folder, '/') === FALSE)
{
    if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE)
    {
        $system_folder = realpath(dirname(__FILE__)).'/'.$system_folder;
    }
}
else
{
    // Swap directory separators to Unix style for consistency
    $system_folder = str_replace("\\", "/", $system_folder);
}
//edited my RABBI(me)
//i edited this line for seeing the $system_folder output
echo $system_folder;

It is showing this: "C:\Inetpub\wwwroot\ci/system"

Is it correct actually?

In Internet Explorer, this link:
http://localhost/ci/index.php/blog/index
is telling that "The page cannot be found".


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

[eluser]stuffradio[/eluser]
You shouldn't need to touch the main index file. Did you correctly set the base_url? It should be 127.0.0.1 or localhost.