Template:Related models

From Disney•Pixar CARS Wiki
Jump to navigation Jump to search
This template is a component of another, as to help organize (and/or optimize) a larger structure of code. It is not meant to be called individually and should never be placed into an article.

SQL (Cargo)-based footer for Vehicle: pages. Absent a full-text search engine like Elastic, this is a (perhaps minimal) substitute for the functionality a related articles extension would provide. At the bottom of every page, three "more vehicles" are selected – based firstly on page-name keywords, then simply at random on fallback – and offered to the reader.

If desired, a second set of manual recommendations can be included by setting |related1=, |related2=, and |related3= in the {{vehicle infobox}} to the "related models" you wish to suggest. Just like in a case, make sure the input value exactly matches the Vehicle: page name (exempting ' single and " double quotes, which can be omitted.)

Algorithm

If you can really call it that, a simple {{#rreplace:}} splits each word in the page title, and feeds them each as {{#cargo_query:}} keyword strings. Fabulous Lightning McQueen becomes [vehicle] Name like '%Fabulous%' OR Name like '%Lightning%' OR Name like '%McQueen%'; a couple extra rules exclude any "related models" already set, alongside vehicles with no main photo. That's it.

In all seriousness, this feature is basically an afterthought, strewn together in reaction to (unforeseen) challenges holding back more powerful tools. We will hopefully flesh it out a bit more in the near future.

Parameters

All three |relatedN= names are set and passed down by variable from the vehicle infobox. This component template is transcluded as part of {{table end}}.

Name Type Notes
|related1= string Corresponds to left recommendation box. Value received from {{#var:related1}}
|related2= string Corresponds to middle recommendation box. Value received from {{#var:related2}}
|related3= string Corresponds to right recommendation box. Value received from {{#var:related3}}

See also

  • {{RelatedVehicles}} - Formatter for the template query, i.e. where the actual element structure is.
  • Help:Vehicle - Rules for the "related models" settings.