Difference between revisions of "Template talk:Water geohash"

From Geohashing
imported>Jevanyn
(if {{PAGENAME}}.indexOf("User:") ...)
 
imported>Jevanyn
 
Line 7: Line 7:
  
 
Anyone? -- [[User:Jevanyn|Jevanyn]]
 
Anyone? -- [[User:Jevanyn|Jevanyn]]
 +
 +
:There is a function called rmatch that uses regex.  I also got the template to do pretty much what I wanted without it: when the name argument matches the page name, or is blank add the pirate category; otherwise add the geohash achievement category.  It does not handle the case of <code><nowiki>[[User:Whoever|Whoever]]</nowiki></code>, but if a user's name is linkified, you're probably not on the user's page anyway. -- [[User:Jevanyn|Jevanyn]]

Latest revision as of 22:33, 8 January 2009

Identifying users as pirates

I wanted to change the template, so that if the current page was a user page, then the Pirates category would be added. However, there don't seem to be any string-comparison functions in the wiki template langauge, and my PHP fu is weak. Something like this:

{{#if "{{PAGENAME}}" ~ "User:.*"|[[Category:Pirates]]|}}

Anyone? -- Jevanyn

There is a function called rmatch that uses regex. I also got the template to do pretty much what I wanted without it: when the name argument matches the page name, or is blank add the pirate category; otherwise add the geohash achievement category. It does not handle the case of [[User:Whoever|Whoever]], but if a user's name is linkified, you're probably not on the user's page anyway. -- Jevanyn