Template:Findbox
From Wikipedia, the free encyclopedia
No userbox found |
Usage: {{findbox|<whatever>}}
This template searches for a page named 'User<whatever>', 'Template:User <whatever>', '<whatever>', or a '<whatever>' page in the directory of various userspace archives. It returns the contents of the first page found or 'User:CBDunkerson/NoBox' if no pages ending in <whatever> were found. This will generally be a userbox, but because of the wide search area it could theoretically be any page... for instance, {{findbox|Wikipedia:Userboxes}} would return the entire contents of Wikipedia:Userboxes. However, that 'any page search' is performed last and thus would only be reached if the requested page name cannot be found in any of the 'designated' userbox locations.
New userspace archives can be added to this list by making the following changes:
- Copy one of the lines which starts with '{{#ifexist: User:' to a new row. This should be somewhere after the first line, but before the '{{#ifexist: {{{1}}}' line.
- Edit this new line to specify the location of your userbox archive. Note that you need to do this twice for each line... the locations specified before and after the '|' character on each line should be identical. If all of the pages in your archive begin with 'User' or some other prefix you should include this... 'User:<yourname>/<subpagename>/User {{{1}}}' would find 'User:<yourname>/<subpagename>/User frogs' if {{{1}}} = frogs. If your archive does not include a prefix you may want to include {{UCFIRST:{{{1}}}}} instead of just {{{1}}} after the sub-page name. This will automatically capitalize the first letter of any page searched for so that it can be found regardless of whether the user who typed it capitalized it or not. However, if the sub-page names you store pages under are sometimes in lower case this will not work properly.
- Go to the last line of the 'code' before these instructions. There is a long list line of '}' characters followed by ' }}<noinclude>'. Add two more '}' characters to the long list after the '{1' for each new #ifexist line you added.
- Save the updated template.
Note that this template currently checks for 'Template:User <whatever>' pages towards the end of the list. This should really be the first area checked, but during this transition period it would produce bad results. For example {{findbox|Christian}} would go to User:CharonX/Userboxes/User christian... and return a blank result because that page just has a 'non-includable' note saying that the page has been relocated. Once migration is complete these 'relocation' notes should probably be deleted and the 'Template:User' line moved to the top of the 'findbox' search list.