Hi Ingmar,

(sorry for the cited German mail below, but I hope you'll understand the 
context if you read the answer. I think that this discussion is of 
general interest to all developers, and thus I forwarded it to the devel 
list as well)

trust me, I'd be very happy if I knew how to make what you suggest, as 
it would enable many more functions than currently possible.

Right now template parameters don't get replaced within inline queries, 
and I don't know why. The question seemed to have arisen a few times on 
the MediaWiki devel list, but with no conclusive answer yet. We are able 
to expand magic words like PAGENAME or CURRENTDATE and use them in the 
queries, which is already quite helpful, but it would be even better to 
be able to expand all parameters provided by the template call, just 
like in a normal function call.

Right now this is happening in SMWInlineQuery::getHTMLResult, in the 
SMW_InlineQueries.php file. We call the replaceVariables function, but 
it does not work as we want to. Maybe we get the wrong parser here, and 
thus it doesn't have the appropriate context. Maybe what we reach for is 
not foreseen in the current implementation. I am a bit of a loss here.

I hope with these pointers you can figure out a solution -- this would 
be great!

Cheers,
denny


Ingmar wrote:
> Hallo zusammen!
> 
> Ich sitze hier, versuche, eine fuchsige Extension für Mediawiki zu
> schreiben und bin voll der Ehrfurcht, wie ihr das Biest Mediawiki
> zähmen konntet. Ich glaube, ich würde wahnsinnig werden, wenn ich
> länger als zwei Stunden am Stück auf Parser::braceSubstitutions starre
> :-)
> 
> Könntet ihr mich vielleicht in die richtige Richtung stupsen? Es geht
> darum: Stellt euch vor, ich habe eine Page:
> 
> {{MyTemplate|
>  foo=Ingmar
> }}
> 
> ein Template
> 
> <myext value="{{{foo}}}" />
> 
> und eine Extension
> 
> function renderMyExt( $input, $argv, $parser = null ) {
>  echo $argv['value'];
> }
> 
> Dies spuckt mir natürlich {{{foo}}} aus, und nicht meinen geliebten 
> Vornamen.
> 
> Ich möchte irgendwie hinkriegen, daß die Argumente von Extensions
> (oder auch der Body) gerendert wird. Falls ihr da irgendwelche
> Hinweise habt, wäre ich mehr als glücklich!
> 
> Grüße,
>  Ingmar

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Semediawiki-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to