issue with controllers Help!!! :( |
[eluser]LeonardoRaygoza[/eluser]
Hi, I'm having a problem because I created a new controller with a simple function called hello, with just a function index(), but it's appear like it doesn't run right. my controller name is: blog my code is: <?php class Blog extends Controller { function index() { echo "Hello world!"; } } ?> I tryied to check it on my server with my domain for example: http://www.leonardoraygoza.com/blog/ it suppouse show Hello world! on my localhost it works! but on my web server it doesn't I have on my config file system > application > config > config.php $config['base_url'] = "http://localhost/"; //localhost $config['base_url'] = "http://leonardoraygoza.com/"; //webserver so I don't know where I'm wrong :'( can please somebody help me
[eluser]LeonardoRaygoza[/eluser]
yes I have on routers.php $route['default_controller'] = "blog"; I don't have an htaccess, so I'm trying to access http://leonardoraygoza.com/index.php/blog/ but it doesn't works ![]()
[eluser]eoinmcg[/eluser]
What errors are you getting on your webserver? You're controller isn't called Blog.php by any chance? A common pitfall is moving from a windows development environment to a live *nix one and forgetting that *nix filenames are case sensitive whereas on windows this isn't the case.
[eluser]BrianDHall[/eluser]
Also, index.php/blog I believe only works when mod_rewrite is turned on in apache, otherwise your server will say "Huh, there is no directory called index.php with a directory inside it named blog, error!" In your config.php you can try turning on query strings and use its suggested syntax, which I believe is http://leonardoraygoza.com/index.php?c=blog&m=index If that works then your problem is related to your webserver, or your CI uri_protocol setting in config.php. What sort of 404 is your server returning? If it is the regular 404 you are use to seeing elsewhere on the internet, it is a server configuration issue. If it is CI's custom 404, then it is a setting in your configuration of CI.
[eluser]LeonardoRaygoza[/eluser]
well I'm not really sure what was the issue I just delete the system folder of my webserver and upload it again and it works! hehe thx everybody for help! ![]()
[eluser]wiredesignz[/eluser]
[quote author="BrianDHall" date="1261445017"]Also, index.php/blog I believe only works when mod_rewrite is turned on in apache, otherwise your server will say "Huh, there is no directory called index.php with a directory inside it named blog, error!"[/quote] @BrianDHall, Please stop telling people this, it is totally incorrect. mod_rewrite is not required to run a basic CodeIgniter installation.
[eluser]BrianDHall[/eluser]
That can happen, when all else failes delete everything and start over ![]()
[eluser]DJMOHNL[/eluser]
if you make a controller try my template: i have an editor called PHPdeisgner 7 its realy cool designer for php, with autocomplete and templates you can make. Look this fill it in with your class name and function name.. the example template below shows you the function/cass name "Test" rename "Test" to your function/class name and you have a new controller... Code: <?php good luck with it.
[eluser]CI_avatar[/eluser]
you did not initialize your controller Code: class Blog extends Controller |
Welcome Guest, Not a member yet? Register Sign In |