[drupal-devel] "Automatic relative URL" generation?
Can Drupal support "automatic relative URL" generation? By automatic relative URL" I mean something similar to MediaWiki's "[[]]" construct: http://meta.wikimedia.org/wiki/Help:Editing#Links.2C_URLs For example, rather then hard-coding this entire URL into the content of this message: http://drupal.org/node/21832 ...I would prefer the Drupal new-post mechanism take this URL string and auto-convert it to something that just says "/node/21832" and will automatically change if the server is "assigned" a new primary "base" URL/domain address. This can also help (and is my biggest purpose) with local "caches" of Drupal content for "snapshot" reference, say as an included documentation set for a product that was developed using Drupal for said product's collaboration and/or documentation. Alternatively, maybe Drupal could allow the author to make a reference like [[node/21832]] to do the same as above (and still support pathauto aliases in the process). Does my explanation make any sense? Does this capability exist? Possibly via some module or patch? -Matt
Hello, Yes drupal does support this. It is actually the only method that is used. If you have a look at the source you will see that all the url's are node/1234 or q=node/1234 (depending on clean urls) Gordon. Matt England wrote:
Can Drupal support "automatic relative URL" generation?
By automatic relative URL" I mean something similar to MediaWiki's "[[]]" construct: http://meta.wikimedia.org/wiki/Help:Editing#Links.2C_URLs
For example, rather then hard-coding this entire URL into the content of this message: http://drupal.org/node/21832
...I would prefer the Drupal new-post mechanism take this URL string and auto-convert it to something that just says "/node/21832" and will automatically change if the server is "assigned" a new primary "base" URL/domain address. This can also help (and is my biggest purpose) with local "caches" of Drupal content for "snapshot" reference, say as an included documentation set for a product that was developed using Drupal for said product's collaboration and/or documentation.
Alternatively, maybe Drupal could allow the author to make a reference like [[node/21832]] to do the same as above (and still support pathauto aliases in the process).
Does my explanation make any sense?
Does this capability exist? Possibly via some module or patch?
-Matt
!DSPAM:427ed065310001605869249!
Alternatively, maybe Drupal could allow the author to make a reference like [[node/21832]] to do the same as above (and still support pathauto aliases in the process).
As Gordon said, this is how Drupal works by default. No additional modules or patches are needed to make your site work with a flexible base URL. For example, my site is accessible via its main address, www.greenash.net.au, and also via its secondary address, www.greenash.com.au. Both of these addresses are pointing to the same Drupal install. If you visit either of them, you will see that all the URLs on my site change to reflect whatever address is being used by the site's visitor. There are two things that you should do to make this functionality work: 1. Type in all links on your site using only the relative path. For example, if you're writing a new story node, and you're putting hyperlinks in the text, make them 'href="node/123"' instead of 'href="mysite.com/node/123"'. Typing in 'href=""' will create a link to the front page. 2. If you use parked domains (i.e. multiple domain names pointing at one site, such as with my site), then make sure that you set the $base_url in your sites/default/settings.php file as follows: $base_url = "http://". $_SERVER["HTTP_HOST"]; Jaza.
participants (3)
-
Gordon Heydon -
Jeremy Epstein -
Matt England