Template:LocoInfobox: Difference between revisions

A searchable database of Lionel O Gauge locomotives
(Replaced content with " # Enabled skins. # The following skins were automatically enabled: wfLoadSkin( 'MinervaNeue' ); wfLoadSkin( 'MonoBook' ); wfLoadSkin( 'Timeless' ); wfLoadSkin( 'Vector' ); wfLoadExtension ( 'VisualEditor' ); #This is code that Claude had me enter to add a particular font to the site. $wgHooks['BeforePageDisplay'][] = function( $out ) { $out->addStyle('https://fonts.googleapis.com/css2?family=Overpass:wght@400;700&display=swap'); }; # End of automatically gene...")
Tag: Replaced
No edit summary
Line 1: Line 1:


# Enabled skins.
<noinclude>
# The following skins were automatically enabled:
== Template:LocoInfobox ==
wfLoadSkin( 'MinervaNeue' );
Universal infobox for individual product pages. Color is automatically determined by
wfLoadSkin( 'MonoBook' );
the <code>loco_category</code> parameter via #switch. Never set color manually.
wfLoadSkin( 'Timeless' );
wfLoadSkin( 'Vector' );


wfLoadExtension ( 'VisualEditor' );
Called on every product page alongside <code>{{LocoTechInfobox/Lionel}}</code> directly
below it. No blank line between the two template calls — MediaWiki renders them as a
visual stack: universal infobox on top, tech infobox directly below, both right-aligned.


#This is code that Claude had me enter to add a particular font to the site.
The road name logo appears at the very top of the infobox. The template automatically
$wgHooks['BeforePageDisplay'][] = function( $out ) {
constructs the filename from the road_name parameter. If no logo file exists, the road
    $out->addStyle('https://fonts.googleapis.com/css2?family=Overpass:wght@400;700&display=swap');
name is displayed as a text label.
};


# End of automatically generated settings.
Requires: ParserFunctions extension + <code>$wgPFEnableStringFunctions = true</code>
# Add more configuration options below.
(for <code>#replace</code> to construct logo filenames).


# Enabling ParserFunctions per Claude
=== Usage ===
wfLoadExtension( 'ParserFunctions' );
<pre>
$wgPFEnableStringFunctions = true;
{{LocoInfobox
| item_number        =  
| manufacturer      =
| loco_type          =
| wheel_arr          =
| proto_manufacturer =
| loco_category      =
| road_name          =
| road_number        =
| proto_era          =
| year              =
| catalog_season    =
| product_line      =
| scale              =
| min_curve          =
| run_type          =
| msrp              =
| notes              =
}}
</pre>


$wgTmpDirectory = "/home/railr867/tmp_8tsovt";
=== Parameters ===
# $wgShowExceptionDetails = true;
{| class="wikitable"
$wgRawHtml = true;
! Parameter !! Description !! If Empty
|-
| <code>item_number</code> || Catalog item number || —
|-
| <code>manufacturer</code> || Manufacturer name; linked to manufacturer category page || —
|-
| <code>loco_type</code> || Linked to Loco Type category page || —
|-
| <code>wheel_arr</code> || Wheel arrangement; linked to Wheel Arr. category page for Steam, plain text for all others || —
|-
| <code>proto_manufacturer</code> || Prototype builder. Non-steam: linked to Proto Mfg category page. Steam/Other: plain text. || —
|-
| <code>loco_category</code> || Drives color scheme; linked to Loco Category page. Values: Steam, Diesel, Electric, Cab Car, Other || —
|-
| <code>road_name</code> || Linked to Road Name category page; drives logo display at top of infobox || —
|-
| <code>road_number</code> || Prototype road number on the model || —
|-
| <code>proto_era</code> || e.g. 1945–1964 || —
|-
| <code>year</code> || Catalog year; linked to Catalog Year category page || —
|-
| <code>catalog_season</code> || e.g. Vol 2 || —
|-
| <code>product_line</code> || Linked to Product Line category page || —
|-
| <code>scale</code> || Scale or Non-Scale; linked to Scale category page || —
|-
| <code>min_curve</code> || Minimum curve radius e.g. O36 || —
|-
| <code>run_type</code> || e.g. Catalog Run, Built to Order, Limited Run || —
|-
| <code>msrp</code> || Original retail price at release || —
|-
| <code>notes</code> || Free text notes from spreadsheet. '''Hidden entirely when empty.''' || (hidden)
|}


$wgRestrictDisplayTitle = false;
=== Color Reference ===
Colors applied automatically via loco_category. Do not set manually.
{| class="wikitable"
! loco_category !! Header (dark) !! Alt rows (light)
|-
| Steam || #6B1E2A || #F5E6E8
|-
| Diesel || #4A4A4A || #F0F0F0
|-
| Electric || #8B6914 || #FDF6D8
|-
| Cab Car || #8B6914 || #FDF6D8
|-
| Other / default || #1E2B7A || #D0D5F0
|}
</noinclude><includeonly><div class="railrosterdb-infobox loco-infobox" style="float:right; clear:right; margin:0 0 0 1em; width:280px; border:1px solid #aaa; background:#fff; font-size:0.9em; line-height:1.5;">
 
<!-- PROTOTYPE PHOTO / PLACEHOLDER -->
{{#ifexist:File:Photo-Prototype-{{{loco_type_slug|}}}.jpg
| [[File:Photo-Prototype-{{{loco_type_slug|}}}.jpg|278px|center|{{{loco_type|}}} prototype photo]]
| <div style="background:#f8f9fa; border-bottom:1px solid #a2a9b1; padding:10px 8px; text-align:center; font-size:0.8em; color:#54595d;">No prototype photo yet — [{{fullurl:Special:Upload|wpDestFile=Photo-Prototype-{{{loco_type_slug|}}}.jpg}} Upload photo]</div>
}}
 
<!-- ROAD NAME LOGO / LABEL -->
<div style="background:{{#switch:{{{loco_category|}}}|Steam=#6B1E2A|Diesel=#4A4A4A|Electric=#8B6914|Cab Car=#8B6914|#default=#1E2B7A}}; padding:6px 8px; text-align:center; border-bottom:1px solid rgba(255,255,255,0.3);">{{#ifexist:File:Logo-{{#replace:{{{road_name|}}}| |-}}.png
| [[File:Logo-{{#replace:{{{road_name|}}}| |-}}.png|260px|center|{{{road_name|}}}]]
| <span style="color:#ffffff; font-weight:bold; font-size:1.05em;">{{{road_name|}}}</span>
}}</div>
 
<!-- INFOBOX TITLE -->
<div style="background:{{#switch:{{{loco_category|}}}|Steam=#6B1E2A|Diesel=#4A4A4A|Electric=#8B6914|Cab Car=#8B6914|#default=#1E2B7A}}; color:#ffffff; font-weight:bold; padding:5px 8px; text-align:center; border-top:1px solid rgba(255,255,255,0.2);">{{#if:{{{prod_name|}}}|{{{prod_name}}}|{{PAGENAME}}}}</div>
 
<!-- MAIN FIELDS -->
<table style="width:100%; border-collapse:collapse;">
 
<tr style="background:{{#switch:{{{loco_category|}}}|Steam=#F5E6E8|Diesel=#F0F0F0|Electric=#FDF6D8|Cab Car=#FDF6D8|#default=#D0D5F0}};">
  <th style="padding:3px 6px; text-align:left; font-weight:bold; width:45%;">Item #</th>
  <td style="padding:3px 6px;">{{#if:{{{item_number|}}}|{{{item_number}}}|—}}</td>
</tr>
<tr>
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Manufacturer</th>
  <td style="padding:3px 6px;">{{#if:{{{manufacturer|}}}|[[:Category:{{{manufacturer}}} Locomotives|{{{manufacturer}}}]]|—}}</td>
</tr>
<tr style="background:{{#switch:{{{loco_category|}}}|Steam=#F5E6E8|Diesel=#F0F0F0|Electric=#FDF6D8|Cab Car=#FDF6D8|#default=#D0D5F0}};">
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Loco Type</th>
  <td style="padding:3px 6px;">{{#if:{{{loco_type|}}}|[[:Category:{{{loco_type}}}|{{{loco_type}}}]]|—}}</td>
</tr>
<tr>
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Wheel Arr.</th>
  <td style="padding:3px 6px;">{{#if:{{{wheel_arr|}}}|{{#ifeq:{{{loco_category|}}}|Steam|[[:Category:{{{wheel_arr}}}|{{{wheel_arr}}}]]|{{{wheel_arr}}}}}|—}}</td>
</tr>
<tr style="background:{{#switch:{{{loco_category|}}}|Steam=#F5E6E8|Diesel=#F0F0F0|Electric=#FDF6D8|Cab Car=#FDF6D8|#default=#D0D5F0}};">
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Proto. Manufacturer</th>
  <td style="padding:3px 6px;">{{#if:{{{proto_manufacturer|}}}|{{#ifeq:{{{loco_category|}}}|Steam|{{{proto_manufacturer}}}|{{#ifeq:{{{loco_category|}}}|Other|{{{proto_manufacturer}}}|[[:Category:{{{proto_manufacturer}}} Locomotives|{{{proto_manufacturer}}}]]}}}}|—}}</td>
</tr>
<tr>
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Loco Category</th>
  <td style="padding:3px 6px;">{{#if:{{{loco_category|}}}|[[:Category:{{{loco_category}}} Locomotives|{{{loco_category}}} Locomotives]]|—}}</td>
</tr>
<tr style="background:{{#switch:{{{loco_category|}}}|Steam=#F5E6E8|Diesel=#F0F0F0|Electric=#FDF6D8|Cab Car=#FDF6D8|#default=#D0D5F0}};">
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Road Name</th>
  <td style="padding:3px 6px;">{{#if:{{{road_name|}}}|[[:Category:{{{road_name}}}|{{{road_name}}}]]|—}}</td>
</tr>
<tr>
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Road Number</th>
  <td style="padding:3px 6px;">{{#if:{{{road_number|}}}|{{{road_number}}}|—}}</td>
</tr>
<tr style="background:{{#switch:{{{loco_category|}}}|Steam=#F5E6E8|Diesel=#F0F0F0|Electric=#FDF6D8|Cab Car=#FDF6D8|#default=#D0D5F0}};">
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Prototype Era</th>
  <td style="padding:3px 6px;">{{#if:{{{proto_era|}}}|{{{proto_era}}}|—}}</td>
</tr>
<tr>
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Catalog Year</th>
  <td style="padding:3px 6px;">{{#if:{{{year|}}}|[[:Category:{{{year}}}|{{{year}}}]]|—}}</td>
</tr>
<tr style="background:{{#switch:{{{loco_category|}}}|Steam=#F5E6E8|Diesel=#F0F0F0|Electric=#FDF6D8|Cab Car=#FDF6D8|#default=#D0D5F0}};">
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Catalog Season</th>
  <td style="padding:3px 6px;">{{#if:{{{catalog_season|}}}|{{{catalog_season}}}|—}}</td>
</tr>
<tr>
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Product Line</th>
  <td style="padding:3px 6px;">{{#if:{{{product_line|}}}|[[:Category:{{{product_line}}}|{{{product_line}}}]]|—}}</td>
</tr>
 
<!-- FEATURES SUB-HEADER -->
<tr>
  <td colspan="2" style="background:{{#switch:{{{loco_category|}}}|Steam=#6B1E2A|Diesel=#4A4A4A|Electric=#8B6914|Cab Car=#8B6914|#default=#1E2B7A}}; color:#ffffff; font-weight:bold; padding:3px 8px;">Features</td>
</tr>
 
<tr style="background:{{#switch:{{{loco_category|}}}|Steam=#F5E6E8|Diesel=#F0F0F0|Electric=#FDF6D8|Cab Car=#FDF6D8|#default=#D0D5F0}};">
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Scale</th>
  <td style="padding:3px 6px;">{{#if:{{{scale|}}}|[[:Category:{{{scale}}}|{{{scale}}}]]|—}}</td>
</tr>
<tr>
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Min. Curve</th>
  <td style="padding:3px 6px;">{{#if:{{{min_curve|}}}|{{{min_curve}}}|—}}</td>
</tr>
<tr style="background:{{#switch:{{{loco_category|}}}|Steam=#F5E6E8|Diesel=#F0F0F0|Electric=#FDF6D8|Cab Car=#FDF6D8|#default=#D0D5F0}};">
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">Run Type</th>
  <td style="padding:3px 6px;">{{#if:{{{run_type|}}}|{{{run_type}}}|—}}</td>
</tr>
<tr>
  <th style="padding:3px 6px; text-align:left; font-weight:bold;">MSRP</th>
  <td style="padding:3px 6px;">{{#if:{{{msrp|}}}|{{{msrp}}}|—}}</td>
</tr>
 
<!-- NOTES — hidden entirely when empty -->
{{#if:{{{notes|}}}|
<tr>
  <td colspan="2" style="background:{{#switch:{{{loco_category|}}}|Steam=#6B1E2A|Diesel=#4A4A4A|Electric=#8B6914|Cab Car=#8B6914|#default=#1E2B7A}}; color:#ffffff; font-weight:bold; padding:3px 8px;">Notes</td>
</tr>
<tr>
  <td colspan="2" style="padding:4px 8px; font-size:0.9em;">{{{notes}}}</td>
</tr>
}}
 
</table>
</div></includeonly>

Revision as of 17:14, 27 April 2026


Template:LocoInfobox

Universal infobox for individual product pages. Color is automatically determined by the loco_category parameter via #switch. Never set color manually.

Called on every product page alongside

No model photo yet — Upload photo
Lionel Technical Features
Control Systems
Bluetooth
Legacy Control System
TMCC
LC Universal Remote
LC Individual Remote
Conventional
Features
Sound
Smoke Unit
Odyssey Speed Control
ElectroCoupler

directly

below it. No blank line between the two template calls — MediaWiki renders them as a visual stack: universal infobox on top, tech infobox directly below, both right-aligned.

The road name logo appears at the very top of the infobox. The template automatically constructs the filename from the road_name parameter. If no logo file exists, the road name is displayed as a text label.

Requires: ParserFunctions extension + $wgPFEnableStringFunctions = true (for #replace to construct logo filenames).

Usage

{{LocoInfobox
| item_number        = 
| manufacturer       = 
| loco_type          = 
| wheel_arr          = 
| proto_manufacturer = 
| loco_category      = 
| road_name          = 
| road_number        = 
| proto_era          = 
| year               = 
| catalog_season     = 
| product_line       = 
| scale              = 
| min_curve          = 
| run_type           = 
| msrp               = 
| notes              = 
}}

Parameters

Parameter Description If Empty
item_number Catalog item number
manufacturer Manufacturer name; linked to manufacturer category page
loco_type Linked to Loco Type category page
wheel_arr Wheel arrangement; linked to Wheel Arr. category page for Steam, plain text for all others
proto_manufacturer Prototype builder. Non-steam: linked to Proto Mfg category page. Steam/Other: plain text.
loco_category Drives color scheme; linked to Loco Category page. Values: Steam, Diesel, Electric, Cab Car, Other
road_name Linked to Road Name category page; drives logo display at top of infobox
road_number Prototype road number on the model
proto_era e.g. 1945–1964
year Catalog year; linked to Catalog Year category page
catalog_season e.g. Vol 2
product_line Linked to Product Line category page
scale Scale or Non-Scale; linked to Scale category page
min_curve Minimum curve radius e.g. O36
run_type e.g. Catalog Run, Built to Order, Limited Run
msrp Original retail price at release
notes Free text notes from spreadsheet. Hidden entirely when empty. (hidden)

Color Reference

Colors applied automatically via loco_category. Do not set manually.

loco_category Header (dark) Alt rows (light)
Steam #6B1E2A #F5E6E8
Diesel #4A4A4A #F0F0F0
Electric #8B6914 #FDF6D8
Cab Car #8B6914 #FDF6D8
Other / default #1E2B7A #D0D5F0