Should OpenCart restore the URL Class?

Yes
48
96%
No
2
4%
 
Total votes: 50


Post by Qphoria » Wed Oct 06, 2010 1:44 am

The url class was removed in 1.4.0 because of an executive decision that it "wasn't needed". Immediately after removal, all code developers were up in arms because not only did that require mods to be updated, but it broke the ability to manipulate the url for some mods.

The url class in layman terms, is a common "passthru" point that ALL links went through. Initially it was used to allow automatic manipulation of the the url to:
- fallback https to http if not on a secure server
- swap "&" with "&" before encoding.

This was only the tip of the iceberg, as the class would also allow:
- Customized SEO design of ALL urls
- Implementation of a Token system with only a few changed lines of code
- handling of customized GET vars with a few lines of code

Despite our constant requests to have this added back into the core, it seems it is still not wanted by Daniel.
But the rest of us see great value in adding it back in and would like to know if things like customized SEO is something you would like to see in future versions? If so then this would need to be added back in.

Most other frameworks I've seen offer a common url class:

PrestaShop has the "link.php class"
CodeIgniter has an "Anchor class"
Drupal has their "url class"
Wordpress has a the "esc_url" method
CakePHP has the link htmlhelper

Almost every big name framework or script has one. I don't understand why we shouldn't.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by JAY6390 » Wed Oct 06, 2010 2:50 am

Pretty sure every framework will have something similar, known as a helper in things like CakePHP

Image


User avatar
Guru Member

Posts

Joined
Wed May 26, 2010 11:47 pm
Location - United Kingdom

Post by dbstr » Wed Oct 06, 2010 4:06 am

Yes please!

Request Reviews v1.0 released.


Active Member

Posts

Joined
Sun Aug 30, 2009 12:20 am

Post by jayman » Wed Oct 06, 2010 4:29 am

It should have never been removed.

New member

Posts

Joined
Wed Apr 07, 2010 1:32 pm

Post by CaptainDDL » Sat Oct 09, 2010 6:02 am

Howdy. :) I've just been skimming through the forums, trying to find out what I'll be getting myself into if I decide to switch from OScommerce. This place seems pretty active. ;D

Back to the topic, I'm curious, how are URLs handled at this time? Are they ran through htmlspecialchars, or just left as-is? A single class to handle all URLs makes sense to me.

Newbie

Posts

Joined
Sat Oct 09, 2010 5:55 am

Post by Qphoria » Sat Oct 09, 2010 7:26 am

They are not run through htmlspecialchars like they should be. Instead all links are simply spelled out and str_replaced in the view. It's quite ridiculous.


Old way:
Controller:

Code: Select all

$this->data['href'] = $this->url->http('common/home'); // This url class cleaned up the url     
View:

Code: Select all

<a href="<?php echo $href; ?>">

Current way:
Controller:

Code: Select all

$this->data['href'] = HTTP_SERVER . 'index.php?route=common/home'; //No class. Just raw  
View:

Code: Select all

<a href=<?php echo str_replace('&', '&', $href); ?>">

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by mystifier » Sat Oct 09, 2010 2:55 pm

I voted yes, but I am very easily seduced. It seems to make very good sense.

I would be interested to hear Daniel's rationale as to why it shouldn't be adopted/restored.

Free v1.4.9 Extensions: Default Specials | Improved Search | Customer Activity Report | Customer Groups | Royal Mail With Handling | Improved Product Page | Random Products | Stock Report | All Products


User avatar
Active Member

Posts

Joined
Tue May 18, 2010 5:15 pm

Post by dbstr » Sat Oct 09, 2010 3:09 pm

mystifier wrote:I voted yes, but I am very easily seduced. It seems to make very good sense.

I would be interested to hear Daniel's rationale as to why it shouldn't be adopted/restored.
http://forum.opencart.com/viewtopic.php ... 906#p58593

Request Reviews v1.0 released.


Active Member

Posts

Joined
Sun Aug 30, 2009 12:20 am

Post by i2Paq » Sat Oct 09, 2010 10:15 pm

İ voted YES, please restore the old way.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by mondy » Sun Oct 10, 2010 9:00 am

b"h

Daniel's opinion is missing.
In general, if it works why to touch it ?
Every change can lead to more bugs.
Mo.

New member

Posts

Joined
Tue Nov 11, 2008 8:01 am

Post by fireatwire » Mon Oct 11, 2010 7:35 pm

I think that Daniel will have a good point to have it this way. So please D, tell us why.

New member

Posts

Joined
Wed Feb 03, 2010 5:21 am

Post by Qphoria » Fri Oct 29, 2010 3:09 am

Looks like there was 1 vote for NO...

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Xsecrets » Fri Oct 29, 2010 4:50 am

Qphoria wrote:Looks like there was 1 vote for NO...
yeah Daniel probably slipped in here and voted no lol.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by i2Paq » Fri Oct 29, 2010 4:56 am

Qphoria wrote:Looks like there was 1 vote for NO...
Ban! Image

btw. it wasn't me :clown:

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by Daniel » Tue Nov 09, 2010 9:02 pm

I removed it because it should not exist.

whats wrong with

HTTP_SERVER . 'index.php?route=common/home';

compared to:

$this->url->http('common/home');

yes its shorter but what about creating url's in emails when using multi-stores.

$order_info['store_url'] . 'index.php?route=common/home';

I should have done it like this:

$this->config->get('config_url') . 'index.php?route=common/home';

and:

$this->config->get('config_ssl') . 'index.php?route=common/home';


secondly if you did use it to rewrite urls then you have to include a db class in a url class. I don;t like doing this because I prefer to keeep everything seperate and keep things more flexable.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by Qphoria » Tue Nov 09, 2010 11:08 pm

It has nothing to do with being shorter. It has everything to do with a manipulation point of the url

The pain that it was to manually add the token to all 1052 areas in the admin code should be reason enough to prove that the class is needed. With the url class, we could have added a token with a 3 lines of code in the url and the request classes. And there would be no db class needed there. And developers would not have had to edit their code to add token support as it would be automatic.

With the url class, all urls could be formatted in cleaner links by default without even added the seo keyword/url alias

Code: Select all

http://www.site.com/index.php?route=product/product&product_id=50
could be this by default:

Code: Select all

http://www.site.com/product/product/product_id/50
and with url alias could be modified further to:

Code: Select all

http://www.site.com/mens-hats/nike-blue-large-hat.html
This was how it worked in 0.7.9 and it worked perfectly and nobody complained about urls

By leaving it out now, we can't even make a mod to improve it without editing 1052 lines of code... and thats just the admin side. Haven't even checked the catalog side. This just makes opencart unfriendly to developers and that is a step backwards. Whether you think it is needed or not, all other developers who use the cart think it is needed, and they are the ones using it.

We spend too much time as developers with this tedious BS when it could be done so much simpler and give people greater control to create their own url SEO structures.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by i2Paq » Wed Nov 10, 2010 2:43 am

What is the current situation on this?

Has Daniel made up his mind and agreed to return to this URL Class?

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by Qphoria » Wed Nov 10, 2010 3:13 am

i2Paq wrote:What is the current situation on this?

Has Daniel made up his mind and agreed to return to this URL Class?
Lol try reading the last 2 posts noob!

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by i2Paq » Wed Nov 10, 2010 3:45 am

Qphoria wrote:
i2Paq wrote:What is the current situation on this?

Has Daniel made up his mind and agreed to return to this URL Class?
Lol try reading the last 2 posts noob!

:drunk: I totally overlooked Daniels post *puts classes on*

Hmm, what a shame....

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by Daniel » Wed Nov 10, 2010 11:42 pm

not yet. i'm jumping around doing quite a few things at the moment to really think about this. i'm currently trying to work out how to make modules load on some pages and not others. also theres the banner system to think of.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm
Who is online

Users browsing this forum: No registered users and 174 guests