Template talk:BadgeHunter Badge
Overview
- Short Version
- Badge-hunter.com has a view_badges.php page that takes id or name as a variable/parameter. Initially it was thought that the name had to be the badge name without " Badge" on the end. This has since been proven wrong (see below) and the name can be PAGENAMEE.
test
TEst
% Encoded Test
BadgeHunter Badge at Badge-Hunter.com
Easy Template
Right now the template requires the use of the Badge-Hunter ID associated with a given badge. This puts a higher burden of work on anyone attempting to add new badges or standards existing articles.
For some time, the view_badges.php page at badge-hunter.com has had the ability to display badges based on id OR badge name. For wiki, I added code to handle the " Badge" that would be appended to any search based on article name. However, when I tried to edit the template to utilize this feature, I ran up against a wall - the spaces in the article name broke what I was trying to do.
Here is what I tried:
What it should look like is:
Is there a way to adjust the template so that the spaces are properly included/encoded?
Sapph 08:08, 8 June 2007 (EDT)
- I thought there was a 'system' variable, similar to {{PAGENAME}} and {{TOC}} that was effectively PAGENAME formatted for URLs. Searching Media Wiki now. --Konoko 10:51, 8 June 2007 (EDT)\
- Oh, I see. Badgehunter can use the badge name without the " Badge" at the end (like you said above). Trouble is trying to remove that spacebadge from the end but not any badges that have spaces in their names, like Man in Black. If you can get the PAGENAME or PAGENAMEE to have underscores instead of spaces, then you can link the article name without _Badge on the end. Alternitavely, convince Tony to install http://meta.wikimedia.org/wiki/StringFunctions so that we can use sections of a string (PAGENAME in this case) without the " Badge" on the end. Another fix I'd like to see is the use of Namespaces. Instead of Man in Black Badge, it'd be Badge:Man in Black. Like my slash commands, instead of team (Slash Command) it'd be Slash Command:team. That way PAGENAME would be "Man in Black" and "team" respectively, instead of PAGENAME being "Man in Black Badge" and "Team (Slash Command)". (and for slash commands would have the added bonus of not interfering with articles about things in game and their related slash command, like supergroup and supergroup (Slash Command).) --Konoko 11:20, 8 June 2007 (EDT)
- Actually, I coded that page specifically to look for and allow the " Badge" suffix. So that's not the problem. Just the formatted PAGENAME as you mentioned initially. -- Sapph 12:15, 8 June 2007 (EDT)
- Oh, I see. Badgehunter can use the badge name without the " Badge" at the end (like you said above). Trouble is trying to remove that spacebadge from the end but not any badges that have spaces in their names, like Man in Black. If you can get the PAGENAME or PAGENAMEE to have underscores instead of spaces, then you can link the article name without _Badge on the end. Alternitavely, convince Tony to install http://meta.wikimedia.org/wiki/StringFunctions so that we can use sections of a string (PAGENAME in this case) without the " Badge" on the end. Another fix I'd like to see is the use of Namespaces. Instead of Man in Black Badge, it'd be Badge:Man in Black. Like my slash commands, instead of team (Slash Command) it'd be Slash Command:team. That way PAGENAME would be "Man in Black" and "team" respectively, instead of PAGENAME being "Man in Black Badge" and "Team (Slash Command)". (and for slash commands would have the added bonus of not interfering with articles about things in game and their related slash command, like supergroup and supergroup (Slash Command).) --Konoko 11:20, 8 June 2007 (EDT)
According to Help:Variables, {{PAGENAMEE}} encodes spaces as underscores, so this is perfect. I will change the template from the current version:
* [http://www.badge-hunter.com/view_badges.php?id={{{ID}}} {{PAGENAME}}] at [http://www.Badge-Hunter.com/ Badge-Hunter.com]
To this version:
* [http://www.badge-hunter.com/view_badges.php?id={{PAGENAMEE}} {{PAGENAME}}] at [http://www.Badge-Hunter.com/ Badge-Hunter.com]
This will allow the BH template to be used blank, with no variable required. This should make it an order of magnitude easier to add the BH template to badge articles. Thank you for your assistance, Konoko. -- Sapph 12:23, 8 June 2007 (EDT)
- That is EXACTLY the conclusion I got to not moments ago, and was testing it before posting. Already made that change and started updating the articles that used this template. --Konoko 12:26, 8 June 2007 (EDT)
Known valid URL construct thingies
These URLs work.
- http://www.badge-hunter.com/view_badges.php?name=Man%20in%20Black%20Badge
- http://www.badge-hunter.com/view_badges.php?name=Man%20in%20Black
- http://www.badge-hunter.com/view_badges.php?name=Man_in_Black_Badge
- http://www.badge-hunter.com/view_badges.php?name=Man_in_Black
- http://www.badge-hunter.com/view_badges.php?id=117
In addition (and this was a good choice for whomever picked Man In Black as the example), all the above variations with Woman In Black will work. -- Sapph 12:17, 8 June 2007 (EDT)