From: "Charlotte Webb" charlottethewebb@gmail.com Date: 2007/12/20 Thu PM 12:33:41 EST To: "Wikimedia developers" wikitech-l@lists.wikimedia.org Subject: Re: [Wikitech-l] Relative External Links?
On 12/20/07, Andre-John Mas ajmas@sympatico.ca wrote:
I have recently installed Mediawiki as part of my website. Because I am integrating it into an existing site I need to be able to link to stuff already there. The issue I am currently having is that the site is accessed via two URLs (internal and external). For this reason I need links refering to the existing site to be relative.
If understand correctly, you're saying the second half of such a link (to non-mediawiki parts of your site) remains the same, but the first half varies depending on how the site is being accessed.
If this is the case, and if the "internal" URL is only used by the webmaster (you), you could probably "internalize" all of the links (for you only) using a personal javascript at "User:Your_account_on_the_wiki/monobook.js" by doing a search and replace on all urls matching the "external" format.
Something like:
addOnloadHook(function(){ a = document.getElementsByTagName("a"); for(x = 0; x < a.length; x++) a[x].href = a[x].href.replace(/yoursite.com/i, "back.door.of.yoursite.com"); });
I would like to make the support a bit more general this, allowing for links such as:
[/page page]
If I knew which class/method was responsible for parsing this I would be willing to see what it would take to make the changes, since I am not afraid of diving in, its just I don't where I should be looking.
Any ideas?
Andre
I would like to make the support a bit more general this, allowing for links such as:
[/page page]
How about using an interwiki link? Go to your mySQL prompt and type: INSERT INTO mywiki_interwiki (iw_prefix, iw_url) VALUES ('other', '../myOldSite/$1');
Then when you want to link to the other site you do: [[other:link.html|Click Me!]]
On Dec 20, 2007 3:28 PM, Christensen, Courtney ChristensenC@battelle.org wrote:
How about using an interwiki link? Go to your mySQL prompt and type: INSERT INTO mywiki_interwiki (iw_prefix, iw_url) VALUES ('other', '../myOldSite/$1');
Then when you want to link to the other site you do: [[other:link.html|Click Me!]]
There's only one site, from his description. It just has two different URLs, one for internal and one for external access.
On 20-Dec-07, at 15:28 , Christensen, Courtney wrote:
I would like to make the support a bit more general this, allowing for links such as:
[/page page]
How about using an interwiki link? Go to your mySQL prompt and type: INSERT INTO mywiki_interwiki (iw_prefix, iw_url) VALUES ('other', '../myOldSite/$1');
Then when you want to link to the other site you do: [[other:link.html|Click Me!]]
I only have one wiki that I have grafted into a existing web server. The point is that I want to avoid external links that contain the name of the current server, since I prefer to avoid any assumptions about the server name of the current server.
I now have a solution, though it did mean modifying the Wiki source code, but I am okay with this approach.
Thanks for all the suggestions.
Andre
On Dec 20, 2007 10:21 PM, Andre-John Mas ajmas@sympatico.ca wrote:
I only have one wiki that I have grafted into a existing web server. The point is that I want to avoid external links that contain the name of the current server, since I prefer to avoid any assumptions about the server name of the current server.
I now have a solution, though it did mean modifying the Wiki source code, but I am okay with this approach.
I think you would be better off using Platonides' suggestion of trying out {{SERVER}}, instead of modifying the source.
On 20-Dec-07, at 22:27 , Simetrical wrote:
On Dec 20, 2007 10:21 PM, Andre-John Mas ajmas@sympatico.ca wrote:
I only have one wiki that I have grafted into a existing web server. The point is that I want to avoid external links that contain the name of the current server, since I prefer to avoid any assumptions about the server name of the current server.
I now have a solution, though it did mean modifying the Wiki source code, but I am okay with this approach.
I think you would be better off using Platonides' suggestion of trying out {{SERVER}}, instead of modifying the source.
I kinda missed that. Wow it does work :)
Is there a link that lists all the special variables?
Thanks
Andre
Andre-John Mas wrote:
I kinda missed that. Wow it does work :)
Is there a link that lists all the special variables?
Thanks
Andre
http://meta.wikimedia.org/wiki/Help:Variable http://meta.wikimedia.org/wiki/Help:Magic_words
Cheers, Filip
On Thu, Dec 20, 2007 at 10:21:56PM -0500, Andre-John Mas wrote:
I now have a solution, though it did mean modifying the Wiki source code, but I am okay with this approach.
For the benefit of mailing list archive readers, do tell...
Cheers, -- jra
On Dec 21, 2007 1:20 PM, Jay R. Ashworth jra@baylink.com wrote:
On Thu, Dec 20, 2007 at 10:21:56PM -0500, Andre-John Mas wrote:
I now have a solution, though it did mean modifying the Wiki source code, but I am okay with this approach.
For the benefit of mailing list archive readers, do tell...
He already did, in the post dated 5:03 PM EDT, about 20.5 hours ago. The approach was superseded by a superior one suggested by Platonides an hour later.
On Thu, 20 Dec 2007 13:42:57 -0500, Andre-John Mas wrote:
From: "Charlotte Webb" charlottethewebb@gmail.com Date: 2007/12/20 Thu PM 12:33:41 EST To: "Wikimedia developers" wikitech-l@lists.wikimedia.org Subject: Re: [Wikitech-l] Relative External Links?
On 12/20/07, Andre-John Mas ajmas@sympatico.ca wrote:
I have recently installed Mediawiki as part of my website. Because I am integrating it into an existing site I need to be able to link to stuff already there. The issue I am currently having is that the site is accessed via two URLs (internal and external). For this reason I need links refering to the existing site to be relative.
If understand correctly, you're saying the second half of such a link (to non-mediawiki parts of your site) remains the same, but the first half varies depending on how the site is being accessed.
If this is the case, and if the "internal" URL is only used by the webmaster (you), you could probably "internalize" all of the links (for you only) using a personal javascript at "User:Your_account_on_the_wiki/monobook.js" by doing a search and replace on all urls matching the "external" format.
Something like:
addOnloadHook(function(){ a = document.getElementsByTagName("a"); for(x = 0; x < a.length; x++) a[x].href = a[x].href.replace(/yoursite.com/i, "back.door.of.yoursite.com"); });
I would like to make the support a bit more general this, allowing for links such as:
[/page page]
If I knew which class/method was responsible for parsing this I would be willing to see what it would take to make the changes, since I am not afraid of diving in, its just I don't where I should be looking.
Any ideas?
Andre
Try Parser:replaceExternalLinks from includes/Parser.php
wikitech-l@lists.wikimedia.org