A few questions about CI installation

#1
[eluser]php dude[/eluser]
Hello everyone!

I'm in the course of learning CI and so far so good, but I have a few questions about CI installation:

1. How do I fix the 404 error when pointing my browser to the local copy of my website: ex: http://localhost/mywebsite ?
:: At this moment, only this would work: http://localhost/mywebsite/welcome (or whatever page I put there)
:: I added an index.php page inside my view directory but still no luck
:: I cannot create an Index class inside my controllers directory also, so I'm stuck...
:: Why isn't the framework providing such a file instead of the welcome one? Wouldn't this be a better example(starting point) for newcommers?

All I want is to be able to access the home page of my local copy of the website like this: http://localhost/mywebsite/ or http://localhost/mywebsite/index and not like this: http://localhost/mywebsite/welcome


Thank you in advance for any advices!

#2
[eluser]WanWizard[/eluser]
Have you defined the proper routes ( ./application/config/routes.php )?

You don't need index files in CI, everything runs through the front controller, the index.php which is in your document root. Make sure you have the proper rewriting rules.

I suggest you start with the excellent CI tutorials to get familiar with the way CI operates.

#3
[eluser]php dude[/eluser]
damn! lol! I've completely forgotten about that! I've set the default controller and now everything works like a charm.

PS: Now I understand why CI doesn't need the index.php file Smile

Thank you very much!

#4
[eluser]php dude[/eluser]
oh, yeah, one more question:

Why is there no php close tag for all files inside the config directory? Is it intended or missed? I'm just being curious....

#5
[eluser]WanWizard[/eluser]
Second step after you have finished the tutorials: read the excellent user guide . %-P

#6
[eluser]php dude[/eluser]
wow, that's interesting! I never experienced an error coming from here(I've always closed my php scripts)...and, to be completely honest, I've never heard of this until now...so, wow...(btw, why would anyone add any output in a script file after the closing tag anyway? Wouldn't this be completely wrong in the first place??)

I browsed the online manual, but somehow I didn't got so far, so thank you, again, for the link.

#7
[eluser]WanWizard[/eluser]
Usually it's not intentional, but a typo, p.e. a tab or an extra space. Which can cause a lot of trouble with p.e. headers if you're using output buffering (which CI does). And which is extremely hard to find.
This way all whitespace at the end of your script is part of the PHP code, and can never generate output.

#8
[eluser]php dude[/eluser]
okay, that sounds reasonable enough


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.