Welcome Guest, Not a member yet? Register   Sign In
Forced URI Suffix
#1

[eluser]mynameiszanders[/eluser]
Hello all, hope your having a good day! (Thought I'd be polite on my first post Tongue)

I've been using CodeIgniter for the better part of 6 months, well playing with it as a hobby really, I have nothing to show for it on the interweb. I have am currently creating a Template Class, which will go up here shortly, and have plans to create my own Output Class Extender.

When adding a URI Suffix (which works perfectly well, btw), it is not actually required!
For example, a page can be accessed at
'/controller/function.htm'
but not
'/controller/function.html' (404 Error)
which is what I want.

However the page can also be accessed by
'/controller/function' (without the suffix being present).

My question is... How do I force the suffix to be present?? Is there an easy way without changing any or much of the code, or do I have to add this functionality into the URI Class (which I was going to extend anyway, but for different reasons...)?

Thankyou in advance to any one who replies Smile
#2

[eluser]Hermawan Haryanto[/eluser]
Curse Me If I'm Wrong Big Grin, but as I know of, the suffix is by default to NONE, and having a .htm or .html is an optional only. The reason is because CI basically don't really care about that suffix, they only want the name before the suffix and match it with the controllers or functions or routings.

So, if you want to force it, then I guess you have to build your own hooks in pre-processing.

Sincerely,
Hermawan Haryanto
#3

[eluser]mynameiszanders[/eluser]
Ah, it was as I feared, time to think for myself instead of letting CI do the dirty work Tongue
Thanks for the answer, and the quick reply!
#4

[eluser]Hermawan Haryanto[/eluser]
You know what, at my first try of CI (a year and half ago), I'm working my ass of to make CI to work as I wanted, changed here and there, made justification to it so it work as I wanted. But later on, I think I was doing a really stupid thing. Instead of focusing of my projects, I was busy making the changes on the main framework it self.

So, I've learned, I'll just let them (Ellis Lab guy) to think about the functionality and the main framework works great and I'll just adding my things as plugins and libraries as I needed. In that case, whenever there's new version of CI, I won't bother to make up all my update again, instead just plug the new CI and copy my libraries back. Run smooth for over a year now.

Sincerely,
Hermawan Haryanto
#5

[eluser]mynameiszanders[/eluser]
Thankyou for that lovely insight, yes adding just an extension to do exactly the same thing, while slightly longer, is much better! I would be very grateful if you told me what you thought of it, please visit the post containing the extension.




Theme © iAndrew 2016 - Forum software by © MyBB