Template:TOClimit/styles.css and SMW queries: Difference between pages

(Difference between pages)
hw>Mlink-rodrigue
No edit summary
 
No edit summary
 
Line 1: Line 1:
/***Custom TOC levels - Template TOC ***/
Here you can see some examples for simple queries using the  metadata of a wiki page. You can add these queries to any wiki page.
#content #bodyContent .toclimit-1 .toclevel-2, #content #bodyContent .toclimit-1 .toclevel-3,#content #bodyContent  .toclimit-1 .toclevel-4,#content #bodyContent .toclimit-1 .toclevel5 {display:none;}  
 
#content #bodyContent .toclimit-2 .toclevel-3, #content #bodyContent .toclimit-2 .toclevel-4,#content #bodyContent .toclimit-2 .toclevel-5 {display:none;}
==Creating page lists==
#content #bodyContent .toclimit-3 .toclevel-4, #content #bodyContent .toclimit-3 .toclevel-5 {display:none;}
 
=== Show pages in a particular namespace ===
<syntaxhighlight lang="text">
{{#ask:
[[:+]]  <!-- find all pages in the main namespace -->
[[Modification date::+]]<!-- necessary to filter deleted pages -->
|format=ul
|limit=4
}}
</syntaxhighlight>Output example in list style format:<br />{{#ask:
[[:+]][[Modification date::+]]
|format=ul
|limit=4
}}
 
 
'''Notes:'''
 
 
<code><nowiki>[[:+]]</nowiki></code>                      shows pages from the ''Main'' namespace.  
 
<code><nowiki>[[Myspace:+]]</nowiki></code>      shows pages from the namespace ''Myspace''.
 
<code><nowiki>[[:+||Help:+]]</nowiki></code>  shows pages from both the ''Main'' namespace and the namespace ''Help''  (=OR argument)
 
===Output in category style===
<syntaxhighlight lang="text">
{{#ask:
[[:+]][[Modification date::+]]
|format=category
|limit=12
}}
</syntaxhighlight>Output example:{{#ask:
[[:+]][[Modification date::+]]
|format=category
|limit=12
}}
 
===Show pages from a category===
<syntaxhighlight lang="text">
{{#ask:
[[Category:Administration]]
| limit=4
| searchlabel=
| format=ol
}}
</syntaxhighlight>
{{#ask:
[[Category:Administration]]
| limit=4
| searchlabel=
| format=ol
}}
 
===Pages that start with the same page name string===
<syntaxhighlight lang="text">
{{#ask:
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=ol
}}
</syntaxhighlight>List of pages in the ''Main '' namespace and in the namespace ''Manual'' that begin with "Visu".
{{#ask:
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=ol
}}
 
==Results format: Table==
 
===Format "broadtable"===
<syntaxhighlight lang="text">
{{#ask:
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=broadtable
}}
</syntaxhighlight>
 
{{#ask:
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=broadtable
}}
 
 
===Format "datatable"===
<syntaxhighlight lang="text">
{{#ask:
[[~Visu*]][[:+||Handbuch:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5  
| searchlabel=
| format=table
| class=datatable
}}
</syntaxhighlight>
 
{{Messagebox|boxtype=important|Note text=The format declaration  <pre>|format=datatable </pre> currently does not work with the BlueSpice skin. Instead, use the following syntax:  
<pre>
|format=table
|class=datatable
</pre>}}
 
{{#ask:
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5
| searchlabel=
| format=table
| class=datatable
}}
 
{{Box Links-en|Topic1=[https://www.semantic-mediawiki.org/wiki/Help:Inline_queries SMW "ask" queries]|Topic2=[https://www.semantic-mediawiki.org/wiki/Help:Result_formats SMW result formats]}}<br />
 
[[Category:Organization]]
[[de:SMW-Abfragen]]
[[en:{{FULLPAGENAME}}]]

Revision as of 15:37, 26 April 2022

Here you can see some examples for simple queries using the metadata of a wiki page. You can add these queries to any wiki page.

Creating page lists

Show pages in a particular namespace

{{#ask:
[[:+]]  <!-- find all pages in the main namespace -->
[[Modification date::+]]<!-- necessary to filter deleted pages -->
|format=ul
|limit=4
}}

Output example in list style format:

... further results


Notes:


[[:+]] shows pages from the Main namespace.

[[Myspace:+]] shows pages from the namespace Myspace.

[[:+||Help:+]] shows pages from both the Main namespace and the namespace Help (=OR argument)

Output in category style

{{#ask:
[[:+]][[Modification date::+]]
|format=category
|limit=12
}}

Output example:

Show pages from a category

{{#ask: 
[[Category:Administration]] 
| limit=4 
| searchlabel=
| format=ol 
}}
  1. Config manager
  2. Footer
  3. Main navigation
  4. Extended statistics

Pages that start with the same page name string

{{#ask: 
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5 
| searchlabel=
| format=ol 
}}

List of pages in the Main namespace and in the namespace Manual that begin with "Visu".


Results format: Table

Format "broadtable"

{{#ask: 
[[~Visu*]][[:+||Manual:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5 
| searchlabel=
| format=broadtable
}}



Format "datatable"

{{#ask: 
[[~Visu*]][[:+||Handbuch:+]]
[[Modification date::+]]<!-- necessary to filter deleted pages -->
| limit=5 
| searchlabel=
| format=table
| class=datatable
}}
Important!The format declaration
|format=datatable 
currently does not work with the BlueSpice skin. Instead, use the following syntax:
|format=table
|class=datatable



Related info


Discussions