Welcome Guest, Not a member yet? Register   Sign In
CI 2.x->3.x file name changes cause url not work
#1

i'm trying to upgrade CI from 2.2.6 to 3.0.0, i see that i will be changing all controller filename, E.g:
old:
application/controllers/land.php
change to:
application/controllers/Land.php

it will cause the url not work, cannot visit http://xxx.xxx.com/land as before, can only visit http://xxx.xxx.com/Land now
also for all ajax not work.

question:
how can i make my url unchange?
Reply
#2

Sounds like you've hand-written all of your routes, or at least the one you've given as an example.

Unless really necessary, leave CI to do the routing and you shouldn't have this problem.
Reply
#3

(This post was last modified: 11-23-2016, 10:58 AM by petrinze.)

(11-22-2016, 02:40 AM)Narf Wrote: Sounds like you've hand-written all of your routes, or at least the one you've given as an example.

Unless really necessary, leave CI to do the routing and you shouldn't have this problem.

It is a pretty bad habbit to leave the framework do the routing, and its mostly came from the CI community. No offens, it works, it fast, and hurraay, but if you get used to it and start working with other teams / companys on large project, your co-workers gonna kill you. Believe me:
 - You dont want to bound the urls to specific controller names. That could be really messy after a while.
 - The routes.php file is a great "app-map" for you and the entire team.
 - It is really rare. i dont 'member if i seen anything like this in other frameworks -> Whenever you have to work with for instance Laravel, Yii, Symfony, you will be happy you get used to write all of your routes, cuz in the most popular frameworks, you have to.
Good luck!
Reply
#4

Greetings - links in CI 3 do work in lower case, thats all i do. Is it maybe an issue with the server you are using? Or did you use upper case in your routes? Routes should be all lower case. Also speaking of case - upper case your model file names - but use lower case when you load them and call them.

Basically you just need to upper case the Controller, Model, and Library file names and their class names. Pretty much everything else will be lower case.
Reply
#5

(11-22-2016, 01:43 PM)petrinze Wrote: It is a pretty bad habbit to leave the framework do the routing, and its mostly came from the CI community. No offens, it works, it fast, and hurraay, but if you get used to it and start working with other teams / companys on large project, your co-workers gonna kill you. Believe me:
 - You dont want to bound the routes to specific controller names. That could be really messy after a while.
 - The routes.php file is a great "app-map" for you and the entire team.
 - It is really rare. i dont 'member if i seen anything like this in other frameworks -> Whenever you have to work with for instance Laravel, Yii, Symfony, you will be happy you get used to write all of your routes, cuz in the most popular frameworks, you have to.
Good luck!

So ... it's bad, because everybody else does it differently. That's what all of your arguments boil down to. No offense either, but I'm fed up with "frameworks X, Y and Z do it differently" arguments.

It's different, that doesn't mean it's bad.
It has its limitations and downsides, as well as its advantages, just like other routing/configuration strategies.

It is far from perfect, indeed, but in the world of programming, everything is a trade-off - don't forget that.
Reply
#6

(This post was last modified: 11-23-2016, 11:42 AM by petrinze.)

(11-23-2016, 05:38 AM)Narf Wrote:
(11-22-2016, 01:43 PM)petrinze Wrote: It is a pretty bad habbit to leave the framework do the routing, and its mostly came from the CI community. No offens, it works, it fast, and hurraay, but if you get used to it and start working with other teams / companys on large project, your co-workers gonna kill you. Believe me:
 - You dont want to bound the routes to specific controller names. That could be really messy after a while.
 - The routes.php file is a great "app-map" for you and the entire team.
 - It is really rare. i dont 'member if i seen anything like this in other frameworks -> Whenever you have to work with for instance Laravel, Yii, Symfony, you will be happy you get used to write all of your routes, cuz in the most popular frameworks, you have to.
Good luck!

So ... it's bad, because everybody else does it differently. That's what all of your arguments boil down to. No offense either, but I'm fed up with "frameworks X, Y and Z do it differently" arguments.

It's different, that doesn't mean it's bad.
It has its limitations and downsides, as well as its advantages, just like other routing/configuration strategies.

It is far from perfect, indeed, but in the world of programming, everything is a trade-off - don't forget that.

It's not about the framework. It's about the habit. To let the fw do the routing has no other advantage, than faster development, and one less thing to worry about.
To get used to write the routes is not a big deal, but it will be handy in the future, especially when you meet the restful conventions, or other frameworks. I don't intend to annoy you with the "other frameworks" argument, but developers have a quite big chance to meet with other frameworks, and the most popular frameworks has no built in "magic-route" feature.  Therefore, to write your own routes, even if it seems to be unnecessary in the beginning, sooner or later will return the time you spend with it.
ps.: Imagine u have around 40 controller classes, and you have to rename most of them because of the costumer wanna see different things in the url bar. Aaaah, magic routes, get away from me.
Reply
#7

(11-23-2016, 11:36 AM)petrinze Wrote: It's not about the framework. It's about the habit.

So ... this particular habit is bad, because it's not the "other" habit?
You've given no objective arguments about why it's bad, so that's the only logical conclusion I can get from your posts. Everything you've said still boils down to it being different.

Putting that aside, you're missing the one thing about habits that really matters - relying on them is bad.
Habits are what makes learning new things hard, what builds the framework-tribal mentalities, what makes obvious solutions non-obvious, what results in huge architectural problems because you wrote a quick and dirty fix years ago, etc.

You're advocating for investment into one habit over another (that doesn't necessarily exist in the first place), and this doesn't actually help anybody - it replaces one supposed bias with another. That's not the altruistic, universally good advice that you think you're giving.

(11-23-2016, 11:36 AM)petrinze Wrote: To let the fw do the routing has no other advantage, than faster development, and one less thing to worry about.

Even if it is just that one advantage, it is not a small one.

But it's not. By virtue of how the automatic routing works - via following a single convention - it enforces consistent structure, naming scheme that is easy to follow for any newcomer.

(11-23-2016, 11:36 AM)petrinze Wrote: To get used to write the routes is not a big deal, but it will be handy in the future, especially when you meet the restful conventions, or other frameworks.

There's no such thing as "restful conventions".

(11-23-2016, 11:36 AM)petrinze Wrote: I don't intend to annoy you with the "other frameworks" argument, but developers have a quite big chance to meet with other frameworks, and the most popular frameworks has no built in "magic-route" feature.  Therefore, to write your own routes, even if it seems to be unnecessary in the beginning, sooner or later will return the time you spend with it.

The really annoying thing is rather that you're just repeating the same thing with different words.
Nobody should be encouraged to do unnecessary shit in one project, especially if the goal is just to make yourself used to that same shit because it will not be a shit in a different, unknown project in the future. Real projects shouldn't be your testing playground.

If the goal is to learn something, we're talking a different story, but then you go learn it with the tools that are made work that way.

(11-23-2016, 11:36 AM)petrinze Wrote: ps.: Imagine u have around 40 controller classes, and you have to rename most of them because of the costumer wanna see different things in the url bar. Aaaah, magic routes, get away from me.

You'll have to rename either file/function names or manual route entries. That's ultimately the same thing and therefore this argument doesn't make sense.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB