Hi,
My team is using mediawiki to create a wikipedia for our needs. I am trying to create set of pages in it, which need to be linked through some identifiers ( I wont be able to use Templates in this case). So, when a user navigates from one internal page to other, one or more number of parameters need to be passed to the other page. I guess, my question is how to send parameters to an internal page if its not a template. Is there any methodology to implement that ? Please advice.
Thanks, Suresh Kadirvel
On Apr 5, 2005 3:51 PM, suresh.k.kadirvel@gsk.com suresh.k.kadirvel@gsk.com wrote:
My team is using mediawiki to create a wikipedia for our needs.
First, a quick semi-pedantic note: "Wikipedia" is not a generic noun, it is trademark referring to a unique project; what you are setting up is "a wiki". See http://meta.wikimedia.org/wiki/Names (and, possibly become even more confused).
That aside...
So, when a user navigates from one internal page to other, one or more number of parameters need to be passed to the other page.
If there are a fairly small number of possibilities for the parameter, and not too many pages that need to use it either, you could just create a whole set of pages, exhaustively covering all options, and including a template with the correct parameter. e.g.: [[Foo/a]] contains {{content of foo|a}} [[Foo/b]] contains {{content of foo|b}} [[Bar/a]] contains {{content of bar|a}} etc. Still a lot of work to create them all, obviously, so probably not helpful.
I guess, my question is how to send parameters to an internal page if its not a template. Is there any methodology to implement that ?
There's nothing really resembling that in MediaWiki, that I can think of. In general web terms, the obvious solution would be to tack parameters onto the URL, like "¶m1=foo¶m2=bar". The only kind of page that can have magic parameters like that in MediaWiki are "Special pages" - things like [[Special:Search]], [[Special:Contributions]], [[Special:Recentchanges]], etc, which are actually each a separate PHP class (dig through the code for how to create one). These are really designed to be for completely dynamic content, but depending what it is exactly you're trying to achieve, you might be able to use one to stuff variables into an otherwise static piece of content.
Thinking about it, you could even create a special page which took as an argument the "template" page to stuff - as in ...title=Special:Stuffvariables&target=Page_with_variables_on&var1=foo&var2=bar. One key trick is that links to special pages can be made with internal syntax in the style [[Special:<pagename>/<param>]]; they don't, however, get any kind of existence check, so you'd get blue links even if you misspelled the target page's name.
Another approach that occurred to me is to look at where the user has just been - either through the somewhat unreliable "referer" [sic] information, or using some kind of cookie-based tracking system - and then work out what the appropriate params would have been (might be doable if all you needed was the title of the last page visited, say, or something easily retrievable based on that). In terms of implementing something like that, it might be worth checking out the "bread crumbs" extension somebody's implemented at http://public.kitware.com/Wiki/User:Barre/Extensions/kw_bread_crumbs. A word of warning with that approach though - beware MediaWiki's internal parser caching!
I hope these somewhat rambling thoughts are of some use - obviously, it all depends what the exact effect you're trying to create is, and how much coding you are prepared to do to make it happen...
On Apr 5, 2005 11:40 AM, Rowan Collins rowan.collins@gmail.com wrote:
On Apr 5, 2005 3:51 PM, suresh.k.kadirvel@gsk.com suresh.k.kadirvel@gsk.com wrote:
My team is using mediawiki to create a wikipedia for our needs.
First, a quick semi-pedantic note: "Wikipedia" is not a generic noun, it is trademark referring to a unique project; what you are setting up is "a wiki". See http://meta.wikimedia.org/wiki/Names (and, possibly become even more confused).
That aside...
So, when a user navigates from one internal page to other, one or more number of parameters need to be passed to the other page.
If there are a fairly small number of possibilities for the parameter, and not too many pages that need to use it either, you could just create a whole set of pages, exhaustively covering all options, and including a template with the correct parameter. e.g.: [[Foo/a]] contains {{content of foo|a}} [[Foo/b]] contains {{content of foo|b}} [[Bar/a]] contains {{content of bar|a}} etc. Still a lot of work to create them all, obviously, so probably not helpful.
I guess, my question is how to send parameters to an internal page if its not a template. Is there any methodology to implement that ?
There's nothing really resembling that in MediaWiki, that I can think of. In general web terms, the obvious solution would be to tack parameters onto the URL, like "¶m1=foo¶m2=bar". The only kind of page that can have magic parameters like that in MediaWiki are "Special pages" - things like [[Special:Search]], [[Special:Contributions]], [[Special:Recentchanges]], etc, which are actually each a separate PHP class (dig through the code for how to create one). These are really designed to be for completely dynamic content, but depending what it is exactly you're trying to achieve, you might be able to use one to stuff variables into an otherwise static piece of content.
Thinking about it, you could even create a special page which took as an argument the "template" page to stuff - as in ...title=Special:Stuffvariables&target=Page_with_variables_on&var1=foo&var2=bar. One key trick is that links to special pages can be made with internal syntax in the style [[Special:<pagename>/<param>]]; they don't, however, get any kind of existence check, so you'd get blue links even if you misspelled the target page's name.
Another approach that occurred to me is to look at where the user has just been - either through the somewhat unreliable "referer" [sic] information, or using some kind of cookie-based tracking system - and then work out what the appropriate params would have been (might be doable if all you needed was the title of the last page visited, say, or something easily retrievable based on that). In terms of implementing something like that, it might be worth checking out the "bread crumbs" extension somebody's implemented at http://public.kitware.com/Wiki/User:Barre/Extensions/kw_bread_crumbs. A word of warning with that approach though - beware MediaWiki's internal parser caching!
I hope these somewhat rambling thoughts are of some use - obviously, it all depends what the exact effect you're trying to create is, and how much coding you are prepared to do to make it happen...
You also might want to take a look at category pages (categorypage.php), which is a page with combined content: the top part of the page is a standard page like any article page, the bottom part is a dynamic list generated at the time the page is rendered. In categories with many entries, there is the option to move forward and back through the list. This is accomplished using the URL arguments that Rowan mentioned.
The CategoryPage class is derived from the standard article type. Note however that the parameters have no affect on the standard part of the page, only on the dynamically generated category lists.
-- Rich Holton
en.wikipedia:User:Rholton
wikitech-l@lists.wikimedia.org