Consider our site domain: abcdefghijklmn.com
We have a shorter domain at our disposal: abc.com (both examples are made up names)
We'd like for shurly to spew out the short url for abc.com/short instead of the long domain name. I tried to hack this via it's .module by replacing the calls to GLOBAL['base_url'] but the part that comes to the copy box is still displaying the long site name.
Any help how to acheive this greatly appreciated :)
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | define_base_url-1834566-13.patch | 3.91 KB | jibus |
| #11 | define_base_url-1834566-11.patch | 4.01 KB | jibus |
| #10 | define_base_url-1834566-10.patch | 4.01 KB | jibus |
| #7 | base_url_for_short_links-1834566-7.patch | 4.55 KB | jibus |
| #4 | base_url_for_short_links-1834566-4.patch | 4.25 KB | nestor.mata |
Comments
Comment #1
klezmer41 commentedThis one took me a while to figure out. In shurly.module on line 380, $final_url is the variable that the form is using, which relies on _surl() which simply relies on Drupal's url().
More info here: http://api.drupal.org/api/drupal/includes%21common.inc/function/url/7
This would be nice as a configuration option.
Comment #2
jbm333 commentedAlong this same vein, I had to apply this modification to the returned URL on line 559 to get the API to work with a custom base_url.
Comment #3
dddave commentedThat would be a killer feature. *dream*
Comment #4
nestor.mata commentedHi,
Here is a patch for the solution you proposed, but using a Drupal variable (which by default is the base URL of the site) and added a field to change this base URL for a shorter domain.
Also, the patch is applied in the way the view uses it, so the views also use the configured base URL.
Please test and confirm.
I think this solves the problem for those (like me) that has 2 domains, one shorter to be able to use short URL's.
~Nestor
Comment #5
tregismoreira commented#4 works perfectly for me. Thanks ;)
Comment #6
jibus commentedI am not sure about this.
It seems to me very specific. If you have two domains, why not setup two Drupal instances and use the API provided by the module to generate short url ?
Comment #7
jibus commentedAfter some though, it can be useful for sharing content from a website.
Patch updated, a new variable has been created, we need to remove it if we uninstall the module.
Comment #8
Leeteq commentedIs this ready enough to be committed to the -dev branch?
Comment #9
jibus commentedThere is one case where the shortner can be broken.
We need to make the field mandatory, and pre-populate by the base url.
Comment #10
jibus commentedUpdated patch :
Field is now mandatory and is prepopulate by the current url of the drupal installation
Comment #11
jibus commentedPrevious patch is corrupted
Comment #12
jibus commentedCommited against 7.x-1.x
Lets bring this functionnality to D6 version
Comment #13
jibus commentedCommitted against 6.x-1.x
Thanks !
Comment #14
diegoj86 commentedHey, I've just uninstalled the 7.x-1.1 release and installed the dev version. I can see the configuration for the short URL under /admin/config/system/shurly but when I click Save it says "The configuration options have been saved." and the URL gets back to the original (the short URL is actually not saved). It still displays the long URL under /shurly.
Any help appreciated. Thanks.
Comment #15
jibus commentedConfirmed, a new issue has been created.
https://drupal.org/node/2284343