Template talk:BadgeHunter Badge: Difference between revisions
imported>Sekoia (historical) (→Broken) |
imported>Thirty7 (historical) (→Broken) |
||
Line 65: | Line 65: | ||
:Looks like this is still broken. At first I thought it was just the new summer event ones, but after some testing, all I get are "Object not found!" pages.<small> — [[User:MrDolomite|MrDolomite]] • [[User talk:MrDolomite|Talk]]</small> 06:55, 28 June 2012 (UTC) | :Looks like this is still broken. At first I thought it was just the new summer event ones, but after some testing, all I get are "Object not found!" pages.<small> — [[User:MrDolomite|MrDolomite]] • [[User talk:MrDolomite|Talk]]</small> 06:55, 28 June 2012 (UTC) | ||
:: I just updated the template so that it will now at least link to the right part of their site. We could improve the links by providing the type= and ID= parameters, but those would have to be manually determined and updated for each and every badge. -- [[User:Sekoia|Sekoia]] 10:06, 28 June 2012 (UTC) | :: I just updated the template so that it will now at least link to the right part of their site. We could improve the links by providing the type= and ID= parameters, but those would have to be manually determined and updated for each and every badge. -- [[User:Sekoia|Sekoia]] 10:06, 28 June 2012 (UTC) | ||
:::Blech, that sounds... not fun at all. {{User:Thirty7/Sig}} 11:53, 28 June 2012 (UTC) |
Revision as of 11:53, 28 June 2012
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)
Conditional Structure
Thanks for fixing the conditionals. Wiki parsing is tricky. You fixed it while I was playing with it - I got caught in an edit conflict. I left yours, as your code was more efficient. For the record, my fix follows:
{{#if: {{{ID|}}} | * [http://www.badge-hunter.com/view_badges.php?id={{{ID}}} {{PAGENAME}}] at [http://www.Badge-Hunter.com/ Badge-Hunter.com] }}
{{#if: {{{name|}}} | * [http://www.badge-hunter.com/view_badges.php?name={{{name}}} {{PAGENAME}}] at [http://www.Badge-Hunter.com/ Badge-Hunter.com] }}
{{#ifeq: {{{ID|}}} | {{{name|}}} | * [http://www.badge-hunter.com/view_badges.php?name={{PAGENAMEE}} {{PAGENAME}}] at [http://www.Badge-Hunter.com/ Badge-Hunter.com] }}
-- Sapph 14:15, 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)
Broken
It appears that the Badge-Hunter links are all now broken. Looking at their site, it appears they use AJAX or something to pop it up, so there isn't a direct link anymore. Does anyone know if there's some alternate method of linking? If not, in a few days I'll suppress it from showing on the pages until it's fixed. -- Sekoia 02:17, 8 December 2010 (UTC)
- Looks like this is still broken. At first I thought it was just the new summer event ones, but after some testing, all I get are "Object not found!" pages. — MrDolomite • Talk 06:55, 28 June 2012 (UTC)
- I just updated the template so that it will now at least link to the right part of their site. We could improve the links by providing the type= and ID= parameters, but those would have to be manually determined and updated for each and every badge. -- Sekoia 10:06, 28 June 2012 (UTC)
- Blech, that sounds... not fun at all. User:Thirty7/Sig 11:53, 28 June 2012 (UTC)