modxbot / migrate

A testground for migrating issues and other such fun
0 stars 0 forks source link

makeUrl scheme refactoring #8383

Open modxbot opened 12 years ago

modxbot commented 12 years ago

africa_unite created Redmine issue ID 8383

I suggest to change scheme argument in modx->makeUrl on line 924 from 'full' to $scheme: if ($ctx) { $url= $ctx->makeUrl($id, $args, 'full', $options);

'full' option used as default in case we are making URL for resource located in Context different from the current. That makes impossible to generate URL for such a "neighbor" resource with 'http'/'https' schemes. Despite the 'full' scheme provided here to prevent wrong type of URL generation (presumably incomplete with -1 or abs), we could safely send $scheme variabe as argument to $ctx->makeUrl since the same (but more reasonable) check is completed there.

why?

revo has several schemes for url making: from weakest (-1, abs), to universal (full) and then to quite definitive (http/https). only http/https (0/1) schemes do use base_url as part of link assembled.

but most plugins and even $modx->makeUrl just ignore the setting of default scheme you provided in system settings. as for my point of view that (at least) making idea of URL schemes incomplete and frustrating.

As example: I'm making multilingual website with ISO 639 language code in base_url. I want all local links to appear as absolute (not full) and I set that in link_tag_scheme key in system settings. I don't want to use 'full' scheme not just because it generates "longer links" to local resources, but mostly because I'll have to put language shortcut in site_url (i.e.: acme.com/en/) and then I'll have to change that parameter in every context every time I move my site to production server.

modxbot commented 12 years ago

africa_unite submitted:

Oh, sorry, wrote to many words here and then sent it incompleted. So, idea is: current situation with URL schemes pushes us to use 'full' type with any prefix showed in site_url if needed. and it is okay while I have access to [[+id]] in most plugins and right behaviour of $modx->makeUrl at least.