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

[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!';
    }
}
?>
#2

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

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

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

Hopes that works Big Grin
#5

[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?
#6

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

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

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

[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".
#10

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




Theme © iAndrew 2016 - Forum software by © MyBB