Jump to content

Topic on Extension talk:SideBarMenu

inline queries within the SideBarMenu ondiscussionpage:Extension talk:SideBarMenu

3
Keyhan~mediawikiwiki (talkcontribs)

Think for example that We have A Category called Car, and then we create Pages BMW, Mercedes and Toyota with that category.

Then we would like to just use a #ask [[Category:Car]] and then populate the sidebar with the result. But the problem is that the query returns in Page format and Sidebar does not like that. So either SideBar has to be modified to accept Page formats, or there should be a way to get raw data from the ask query.

This post was posted by Keyhan~mediawikiwiki, but signed as Keyhan.

Netbrain (talkcontribs)

Just tested it myself. I got it to work with the following code:

<sidebarmenu>
{{#ask: [[Category:Country]][[:+]] |format=array |name=c}}
Countries{{#loop: i
| 0
| {{#arraysize:c}}
| 
* {{#arrayindex:c | {{#var:i}} }} 
}}
</sidebarmenu>

This creates a sidebarmenu with the contents:

<sidebarmenu>
Countries
*Norway
*Germany
</sidebarmenu>

This solution however requires the extensions Extension:Arrays and Extension:Loops

Keyhan~mediawikiwiki (talkcontribs)

Problem is now fixed. I had forgotten format=template in the in the query. It works greate

This post was posted by Keyhan~mediawikiwiki, but signed as Keyhan.

Reply to "inline queries within the SideBarMenu ondiscussionpage:Extension talk:SideBarMenu"