MediaWiki Template for external URL
I'开发者_如何学Gove created a few templates on our WIKI and I have a basic understanding of how they work. I have one template I'm working on right now that refuses to behave, at least not the way I expect it to. The purpose of the template is to format a external link in a consistent way. The name of the template is "NSURL"
Here is the template markup:
[{{{1}}} Go...]
I'm using it like this:
{{NSURL | https://www.somesecreturl.com}}
When I use the template it prints it out just like the raw template markup. If I replace {{{1}}} with a static URL it works correctly:
[http://www.yahoo.com Go...]
----- Version Info -----
MediaWiki 1.15.1
PHP 5.2.6-1+lenny3 (apache2handler)
MySQL 5.0.51a-24+lenny1
@Steve K - here's my code for an external link to a Wikipedia URL:
[http://en.wikipedia.org/wiki/{{{1|Main_Page}}} {{{2|{{{1|Wikipedia}}}}}}]
Use:
{{Wikipedia|Agile}}
gives Agile{{Wikipedia|Agile_software_development|Agile software development}}
gives Agile software development
See also notes below regarding special characters like ? etc.
Update: if you have Extension:StringFunctions you can use #replace in the second example. This means that the URL will replace spaces with underscores. So the code in the template will be:
[http://en.wikipedia.org/wiki/{{#replace:{{{1|Main_Page}}}| |_}} {{{2|{{{1|Wikipedia}}}}}}]
and on the page you only need:
{{Wikipedia|Agile software development}}
精彩评论