Template talk:ThemeTable

From Brickipedia, the LEGO Wiki

This is the talk page for discussing improvements to the Template ThemeTable.

(theme)[edit source]

So this new workaround is causing some issues with pages that have "(theme)" in their name. I'm not super familiar with wiki templates, so I'm trying to research what a fix might look like. But if I don't find anything, does anybody happen to know a way one could parse PAGENAME to tell if it includes the substring "(theme)"? If there is no simple way to do this, should another workaround be discussed? (i.e. an optional parameter, a separate template, etc.) 108.181.149.186 17:49, 26 February 2017 (UTC)

Before I discuss a solution, what is the actual problem? causing some 'issues' is vague; Please describe the issues. After you describe the actual issue, is there a page that can be used to reproduce the bug that has (theme) in the title string to confirm this is the cause of the fore mentioned bug? Currently you're discussing an attempted solution rather than what the actual bug is (this is also known as the XY problem, see http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem ) SamanthaNguyen (talk) 19:21, 26 February 2017 (UTC)
Right, my apologies, I shouldn't have assumed it was obvious (because, thinking about it more, it's not). The current template takes the pagename and links to the category "{{PAGENAME}} sets". But these categories never have "(theme)" in their names, so that part of the PAGENAME, essentially, does not match the category's name. Consider, for example, The LEGO Batman Movie (theme) vs Category:The LEGO Batman Movie sets. An ideal fix would be to parse PAGENAME for "(theme)" and, if it is included, use a substring of PAGENAME rather than the entirety. While I have found some Wikimedia modules that enable string parsing, they don't seem to be present on 'Media; I'm not entirely sure what we all have to work with. 108.181.149.186 19:37, 26 February 2017 (UTC)


Might the following work?
''Please see [[:Category:{{#sub:{{PAGENAME}}|0|{{#if: {{#pos:{{PAGENAME}}|(theme)}} | {{#pos:{{PAGENAME}}|(theme)}}| {{#len:{{PAGENAME}} }} }} }} sets]]''
I did a page preview and it seems to be fine, but I don't want to make an edit affecting so many pages, without any experience in mediawiki templates, before checking. :P 108.181.149.186 20:00, 26 February 2017 (UTC)
Tested the above in the page previews for a few theme pages and it seems to work, but I'll still wait for confirmation. 108.181.149.186 20:08, 26 February 2017 (UTC)
I haven't tested it, but I see no reason why it wouldn't work. CJC95 (talk) 22:18, 26 February 2017 (UTC)
Thanks for finding the bug and adding a solution- replaced the code and it works fine :) Sorry I should have thought of themes with (theme) in the title in the first place NovaHawk 22:59, 26 February 2017 (UTC)