2006/4/5, Ilmari Karonen nospam@vyznev.net:
Minh Nguyen wrote:
Jan Vanoverpelt wrote:
I think this problem is due to the fact that i have created some kind
of
"hard link" behind the image, so that the user is always forced to go directly to the edit-box with the preloaded text in it. Is there a
way to
fix this, so that the user (after he/she visited the non-existing
page for
the first time, added something and saved it) is directly taken to
the
actual page the second time (like is done in case of "normal" links)
??
Yes, I think there is: the English Wikipedia has an "exists" template http://en.wikipedia.org/wiki/Template:Exists to check if a particular page has been created yet.
Eww! That's clever, but also incredibly ugly. I can see why a template (or a parser function) for this might be useful, but Jan's problem would be much cleanly solved by a small patch to MediaWiki.
A minimal patch would be to add a new action ("action=editnew"?) that would act like "action=edit", but only if the page does not already exist.
Thanks for the reaction, but unfortunately i don't have that much knowledge about patching MediaWiki. Where do i have to define such a new action and how do i have to define it? I would be glad if it just worked (even if it is a little bit ugly ;-) so maybe it is advisable for me to keep trying to use some kind of template?
Recapitulating what i am trying to do: Scenario: 1) The user clicks on an image, which refers to a non-existing page. 2) The user is linked to the non-existing page's edit-box in which the preloaded text is written. 3) The user adds some additional text and saves the page. 4) The user leaves the pages, surfs around on the wiki and goes back to the image through which he previously created the new page. This is the point where the practical problem jumps in: the user clicks on the image, BUT he must be taken to the actual page (which exists now, so he does not have to be linked directly to the edit-box of the page again).
I tried to modify the "exists"-template so that after this template has checked whether a page exists or not, another template (a template with preload-parameter for a new page or a template without preload-parameter for an existing page) is returned:
=> The original qif-code of the {{exists}}-template is: {{qif |test={{booleq |1=[[{{ucfirst:{{{1|defaultFalse}}}}}]] |2={{:{{{1|defaultFalse}}}}} }} |then={{{else|false}}} |else={{{then|true}}} }}
=> I tried to adapt this into: {{qif |test={{booleq |1=[[{{ucfirst:{{{1|defaultFalse}}}}}]] |2={{:{{{1|defaultFalse}}}}} }} |then={{{else|{{hotspot || Image = image-name.gif | Link = name-of-the-page | Preload=Template:templatename | Heigth = 81px}}}}} |else={{{then|{{hotspot-no-preload || Image = image-name.gif | Link = name-of-the-page | Heigth = 81px}}}}} }}
Unfortunately, I want to apply this to several different images, each of which links to a different page so i should have to put this qif-code into different {{exists}}-templates so that each of these different {{exists}}-templates then contains its own " image-name.gif"-reference and "name-of-the-page"-link. This is not efficient because lots of {{exists}}-templates have to be made.
A little bit more efficiently: I could put this qif-code on the wiki each time such an image should be displayed, but i do not understand how the name-of-the-page-parameter can be passed to this qif-code without referring to a global template like {{exists|name-of-the-page}}. What i mean is that when the {{exists}}-template is used, the parameter is passed by {{exists |name-of-the-page}} and then the qif-code knows which page to check. What i would like to accomplish now, is to adapt the qif-code so that i can manually define in the qif-code which page should be checked for existence.
In short: how do i adapt the above qif-code, so that it knows what page to check for existence, without passing the name-of-the-page-parameter via {{exists|name-of-the-page}}?? Or is there another "quite-easy-to-implement"-solution to this problem?
Thanks in advance for any help!
JAN