The Sims Wiki talk:Development Portal: Difference between revisions

Adding explicit layout parameter
imported>Mira Laime
imported>Wikia
(Adding explicit layout parameter)
Line 438:
::For one thing, there's just no way to preview the template without submitting your edit and try the template in a different page. Maybe there's a way to preview it, but I just can't find it at the moment. I spent my evening learning the basics and I just didn't have time to search for things that aren't provided in the help page. Variables used for <nowiki><data source="name"></nowiki> and <nowiki>{{{name}}}</nowiki> don't really work together very well. More about it later, but it's hard to explain...
 
::Secondly, I still haven't figured out how to make the infobox colorful with our convention. We're provided with <code>theme</code> and <code>theme-source</code> attribute to determine the theme, but the way I tried to implement it for {{T|Neighborhood}} is still impossible. Well, it's still possible, but it's ''impractical'' the way I can think of. For example, we want to have a green infobox if the game parameter is TS3 or its EPs / SPs. To do so, we'd need <nowiki><infobox layout="stacked" theme-source="game"></nowiki>, so the theme color will change according to the value specified in the <code>game</code> parameter. However, it means we have to provide as many CSS classes as there are TS3 games for each available tag. This is far from practical.
 
::Then I thought that maybe we could use <nowiki><infobox layout="stacked" theme="{{lc:{{Vgseries|{{{game}}}}}}}"></nowiki> so the value set in game parameter will automatically set the game series and used for the theme. It didn't work either, because the tag cannot recognize wikitext. Then I tried <nowiki><infobox layout="stacked" theme-source="theme"></nowiki> and made a parameter <nowiki>{{{theme}}}</nowiki> somewhere in and outside the infobox, with its default value as <nowiki>{{lc:{{Vgseries|{{{game}}}}}}}</nowiki>, but it still didn't work. You have to explicitly write the parameter when using the template, such as:
 
<pre>
Line 460:
:::But when looked at from a mobile, the new, clean infobox markup should deliver a complete, easy-to-read infobox on every device. Just as before, styling information will still be ignored, but content won't be missed anymore.
 
:::As for having different themes on the same infobox, depending on what kind of article it's on: I know that other communities had that same problem and some have found a way to make it work. Usually with the <nowiki><infobox layout="stacked" theme-source="theme"></nowiki> that you already mentioned, and with theme definitions ins CSS in [[Special:CSS]]. I'm not sure why this shouldn't work in your case, but then I don't know your infoboxes and different themes as well as you do. But maybe you'll find some more good ideas if you look around at what others have done? [[User:Mira_Laime|Mira_Laime]] <staff /> <small>([[w:c:community:Special:Forum|help forum]] | [[w:c:community:Blog:Wikia_Staff_Blog |blog]])</small> 18:07, August 4, 2015 (UTC)
 
==Modular main page templates==
Anonymous user