Difference between revisions of "Template:PrintTopicRelatedTopics"

From Encyclopedia of Scientonomy
Jump to navigation Jump to search
Line 16: Line 16:
 
</noinclude><includeonly><!--
 
</noinclude><includeonly><!--
 
--><!--
 
--><!--
-->{{#arraydefine: values<!--
+
--><!-- get the related topics
-->|<!--
+
-->{{#arraydefine: varRelated|<!--  
   -->{{#compound_query:<!--
+
   -->{{#ask:<!-- first, get the topics related through Has Related Topic property
  --><!-- first, get the topics related through Has Related Topic property
+
   -->[[{{{topic|}}}]]<!--  
   -->[[{{{topic|}}}]]<!--
+
   -->|?Has Related Topic=Topic<!--  
   -->;?Has Related Topic<!--
+
   -->|mainlabel=-<!--
  -->|<!--
 
  -->{{#if: {{{includeparenttopic|}}}|<!--
 
    -->[[{{{topic|}}}]]<!--
 
    -->;?Parent Topic<!--  
 
   -->}}<!-- if
 
  -->|<!--
 
  --><!-- now add the subtopics if necessary
 
  -->{{#if: {{{includesubtopics|}}}|<!--
 
    -->[[Category:Topic]]<!--
 
    -->[[Parent Topic::{{{topic|}}}]]<!--
 
  -->}}<!-- if
 
  -->|<!--
 
 
   -->|headers=hide<!--
 
   -->|headers=hide<!--
  -->|link={{{link|}}}<!--
 
 
   -->|format=list<!--
 
   -->|format=list<!--
  -->|limit=10000<!--
+
   -->}}<!--
   -->}}<!-- compound query
 
 
  -->| , |unique<!--
 
  -->| , |unique<!--
-->}}<!-- array define
+
-->}}<!--
 
--><!--
 
--><!--
 +
--><!-- get the parent
 +
-->{{#arraydefine: varParent|<!--
 +
  -->{{#ask:<!-- first, get the topics related through Has Related Topic property
 +
  -->[[{{{topic|}}}]]<!--
 +
  -->|?Parent Topic=Topic<!--
 +
  -->|mainlabel=-<!--
 +
  -->|headers=hide<!--
 +
  -->|format=list<!--
 +
  -->}}<!--
 +
-->| , |unique<!--
 +
-->}}<!--
 +
--><!--
 +
--><!-- get the subtopics
 +
-->{{#arraydefine: varSubtopics|<!--
 +
  -->{{#ask:<!-- first, get the topics related through Has Related Topic property
 +
  -->[[Category:Topic]]<!--
 +
  -->[[Parent Topic::{{{topic|}}}]]<!--
 +
  -->|mainlabel=Topic<!--
 +
  -->|headers=hide<!--
 +
  -->|format=list<!--
 +
  -->}}<!--
 +
-->| , |unique<!--
 +
-->}}<!--
 +
--><!--
 +
--><!-- merge the arrays
 +
-->{{#arraymerge: values|varRelated|varParent|varSubtopics}}<!--
 +
--><!-- make the values are unique
 
-->{{#arrayunique: values}}<!--
 
-->{{#arrayunique: values}}<!--
 +
--><!-- sort
 +
-->{{#arraysort: values|asc}}<!--
 
--><!--
 
--><!--
 
-->{{#switch: {{#arraysize: values}}<!--
 
-->{{#switch: {{#arraysize: values}}<!--
 
  -->|0={{{default|}}}<!--
 
  -->|0={{{default|}}}<!--
 
  -->|{{{intro|}}}<!--
 
  -->|{{{intro|}}}<!--
   -->{{#arrayprint: values||@@@@|{{#if: {{{bullets|}}}|* |}}@@@@
+
   -->{{#arrayprint: values||@@@@|{{#if: {{{bullets|}}}|* |}}@@@@}}<!--
<br/>
 
<br/>}}<!--
 
 
   -->{{{outro|}}}<!--
 
   -->{{{outro|}}}<!--
 
-->}}<!--
 
-->}}<!--
 
--><!--
 
--><!--
 
--></includeonly>
 
--></includeonly>

Revision as of 06:29, 30 August 2016

This template is used to print an array of topics related to the topic.

NOTE: As any "printing" template, it doesn't store any values anywhere, but merely prints them on the page.

Parameters:

  • |topic= - the page for which related topics are to be printed.
  • |intro= - initial text that precedes the output, if at least some results exist.
  • |outro= - text that is appended to the output, if at least some results exist.
  • |default= - if, for any reason, the query returns no results, this will be printed instead.
  • |link= - determines whether the values are to be printer as links to the respective pages (where available); possible values are none, subject, all. If not given all is the default.
  • |bullets= - if non empty, a bullet-list will be produced.
  • |includeparenttopic= - if non empty, the parent topic is also included in the list.
  • |inclusubtopics= - if non empty, the subtopics of the topic are also included.