![]() |
CodeIgniter Does not run Hello world - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: CodeIgniter Does not run Hello world (/showthread.php?tid=18158) |
CodeIgniter Does not run Hello world - El Forum - 04-27-2009 [eluser]codeman[/eluser] hi Guys, I started learning Code Igniter Today and i am not able to run hello world program, SO i have Localhost, i installed apache and Mysql and everything, I tried running PHP code as well works fine, So i did download codeigniter and put it in the localhost and try to create first controller like this.... <?php class Blog extends Controller { function index() { echo 'Hello World!'; } } ?> Now i go to the path http://IP/CodeIgniter/index.php/blog and it does not print Hello world, What should i do? What am i doing wrong? Please help me CodeIgniter Does not run Hello world - El Forum - 04-27-2009 [eluser]Jagar[/eluser] Does PHP works? What does it display on screen? Change your code to this with constructor Code: class Blog extends controller{ How that helps CodeIgniter Does not run Hello world - El Forum - 04-27-2009 [eluser]Jagar[/eluser] Each time you extend the controller you have to call the Controller constructor otherwise you wouldn't be able to use the stuff. if you have php 5 you can do the following for constructor Code: function __construct(){ Good luck! CodeIgniter Does not run Hello world - El Forum - 04-27-2009 [eluser]Dam1an[/eluser] [quote author="Jagar" date="1240871612"]Each time you extend the controller you have to call the Controller constructor otherwise you wouldn't be able to use the stuff. [/quote] You don't have to, you only need to call the parent constructor if you have your own constructor CodeIgniter Does not run Hello world - El Forum - 04-27-2009 [eluser]jdfwarrior[/eluser] [quote author="Dam1an" date="1240873775"][quote author="Jagar" date="1240871612"]Each time you extend the controller you have to call the Controller constructor otherwise you wouldn't be able to use the stuff. [/quote] You don't have to, you only need to call the parent constructor if you have your own constructor[/quote] Agreed. I never use a constructor. CodeIgniter Does not run Hello world - El Forum - 04-27-2009 [eluser]Jagar[/eluser] Thanks for correcting me. Learning something new everyday ![]() CodeIgniter Does not run Hello world - El Forum - 04-27-2009 [eluser]Dam1an[/eluser] I'm not sure if the forum converted your quotes, but if I copy and paste your code, its not standard single quotes :S CodeIgniter Does not run Hello world - El Forum - 04-27-2009 [eluser]jdfwarrior[/eluser] [quote author="Dam1an" date="1240874201"]I'm not sure if the forum converted your quotes, but if I copy and paste your code, its not standard single quotes :S[/quote] They may be using the auto typography function for the posts. CodeIgniter Does not run Hello world - El Forum - 04-27-2009 [eluser]Dam1an[/eluser] [quote author="jdfwarrior" date="1240874441"][quote author="Dam1an" date="1240874201"]I'm not sure if the forum converted your quotes, but if I copy and paste your code, its not standard single quotes :S[/quote] They may be using the auto typography function for the posts.[/quote] I know they might be, but I was just checking he wasn't using the wrong sort of quotes for an echo, although if he was, I'd expect an error CodeIgniter Does not run Hello world - El Forum - 04-27-2009 [eluser]jdfwarrior[/eluser] @Codeman It's hard to say what it could be. If PHP was working and you simply dropped in CodeIgniter, things should work unless the path's are incorrect or something. I just used this code and it worked. Code: <?php Edit: Which, now I just noticed. The single quotes I put in this post, aren't converted to anything else due to auto typography. So, you obviously have some funny symbols being used. Replace your quotes with actual single (or double) quotes. Do you get any kind of error message? |