Template:CardText: Difference between revisions

From LOTR-TCG Wiki
No edit summary
No edit summary
 
Line 10: Line 10:
   tables=Cards=C,CardReleases=CR,CardReleases=ECR
   tables=Cards=C,CardReleases=CR,CardReleases=ECR
   |join on= C.ID = CR.BaseCardID,ECR.ID = C.ID
   |join on= C.ID = CR.BaseCardID,ECR.ID = C.ID
   |fields= REPLACE(REPLACE(C._pageName, '/Data', ''), 'Data:', '')=PageTitle
   |fields= CONCAT(' ', REPLACE(CR.FormattedGameText, '\n\n', '\n  '))
  , IFNULL(CR.ImageFilename,'File:Card_Not_Found.jpg')=ImageFile
  , IFNULL(CR.Title,ECR.Title)=Title
  , IFNULL(CR.Subtitle,ECR.Subtitle)=Subtitle
  , IFNULL(CR.CollInfo,C.CollInfo)=CollInfo
   |where= CR.ID = '{{IDLookup|{{{1}}}|{{{2|EN}}}}}'  
   |where= CR.ID = '{{IDLookup|{{{1}}}|{{{2|EN}}}}}'  
  |format=template
   |named args=yes
   |named args=yes
  |template=LinkNameWithImage
   |default={{PageLookup|{{{1}}}}}
   |default={{PageLookup|{{{1}}}}}
   }}
   }}
Line 24: Line 18:
   tables=Cards=C,CardReleases=CR,CardReleases=ECR
   tables=Cards=C,CardReleases=CR,CardReleases=ECR
   |join on= C.ID = CR.BaseCardID,ECR.ID = C.ID
   |join on= C.ID = CR.BaseCardID,ECR.ID = C.ID
   |fields= CONCAT('  ', REPLACE(CR.FormattedGameText, '\n', '\n  '))
   |fields= CONCAT('  ', REPLACE(CR.FormattedGameText, '\n\n', '\n  '))
   |where= (C.Title LIKE '{{#replace:{{{1}}}|'|''}}' OR C.Subtitle LIKE '{{#replace:{{{1}}}|'|''}}' OR (C.Title LIKE '{{#explode:{{#replace:{{{1}}}|'|''}}|, |0}}' AND C.Subtitle LIKE TRIM('{{#explode:{{#replace:{{{1}}}|'|''}}|, |1}}'))) AND CR.LanguageCode = '{{{2|EN}}}'
   |where= (C.Title LIKE '{{#replace:{{{1}}}|'|''}}' OR C.Subtitle LIKE '{{#replace:{{{1}}}|'|''}}' OR (C.Title LIKE '{{#explode:{{#replace:{{{1}}}|'|''}}|, |0}}' AND C.Subtitle LIKE TRIM('{{#explode:{{#replace:{{{1}}}|'|''}}|, |1}}'))) AND CR.LanguageCode = '{{{2|EN}}}'
   |order by=CASE WHEN C.SetNum = '0' THEN 100 ELSE CASE WHEN C.SETNUM REGEXP '^-?[0-9]+$' THEN CAST(C.SetNum AS UNSIGNED INTEGER) ELSE 100 END END, CASE WHEN C.Subset = 'S' THEN 0 WHEN C.Subset = 'F' THEN 1 WHEN C.Subset = 'P' THEN 0 WHEN C.Subset = 'D' THEN 1 ELSE 10 END,  C.CardNum
   |order by=CASE WHEN C.SetNum = '0' THEN 100 ELSE CASE WHEN C.SETNUM REGEXP '^-?[0-9]+$' THEN CAST(C.SetNum AS UNSIGNED INTEGER) ELSE 100 END END, CASE WHEN C.Subset = 'S' THEN 0 WHEN C.Subset = 'F' THEN 1 WHEN C.Subset = 'P' THEN 0 WHEN C.Subset = 'D' THEN 1 ELSE 10 END,  C.CardNum

Latest revision as of 21:20, 11 April 2025

This is the "CardText" template.

It should be called in the following format:

{{CardText
|1=
|2=
}}

Edit the page to see the template text.

Parameter 1 should refer to the card. Usually this can just be the card name: {{Card|The One Ring, The Ruling Ring}} or {{Card|The Ruling Ring}} produce The One Ring, The Ruling Ring (1C2) . If you want to link to a different version of the same card, you can use the card's collector number: {{Card|4C2}} produces The One Ring, The Ruling Ring (4C2) . If that doesn't work, you can instead use the "Wiki Base Card ID" parameter, found in each card page's infobox under "Technical Info". For example, using {{Card|LOTR-EN15G060.0}} is currently the only working way to link to the Gondor version Forth the Three Hunters! (15C60) .

Parameter 2 is the language code, which will produce the appropriate title + image for the requested language. {{Card|Gimli, Son of Gloin|FR}} produces Gimli, Fils de Glóin (1R13) , and {{Card|Gimli, Son of Gloin|TW}} produces the tengwar Gimli, Son of Gloin (1R13T) .

If the card is not found (due to a typo, for instance), then it will display like this: Glimlik, Son of Gloin .