Archive talk:Template format
Talk pages on this wiki should primarily be used to address possible mistakes as well as missing and superseded information in the documentation.
In case you are seeking support concerning individual questions, please have a look at this page. The Semantic MediaWiki user mailing list is always a good idea for seeking help.
- [View source↑]
- [History↑]
Contents
Thread title | Replies | Last modified |
---|---|---|
Can you suppress 'further results'? | 1 | 08:58, 17 December 2017 |
Using templates: Case sensitivity of parameters | 1 | 00:03, 4 November 2015 |
Error when value is an URL with an = symbol | 5 | 00:02, 4 November 2015 |
format=template / columns=# | 1 | 00:00, 4 November 2015 |
...Further results | 1 | 23:56, 3 November 2015 |
"sep" parameter | 1 | 23:54, 3 November 2015 |
Clarifying something with named args | 1 | 23:52, 3 November 2015 |
Possible documentation typo, with template argument ordering | 1 | 02:26, 11 October 2015 |
Using Template format to create a working expression | 2 | 16:46, 17 July 2015 |
Templates with paramaters as an "introtemplate" | 1 | 08:44, 27 August 2014 |
Using template with paramaters as an introtemplate | 1 | 08:40, 27 August 2014 |
Quotes in code example are confusing and shouldn't be there (I think) | 1 | 18:16, 18 March 2014 |
I'd like to use the template result type to only display the top five items, but when I do this with 'limit=5' I get a 'further results' link appearing which I can't easily style and it doesn't work anyway due to my creative use of templates. Is it possible to hide the 'further results' link completely?
And like that I realised you can put "searchlabel =" to hide the link. As a side note, the failure of the link to work was partly due to 'named args = yes' not being carried through the 'further results' link (which has been fixed in #1258 by the looks of it, so hopefully it won't be an issue when I get a chance to upgrade.
(1) Documentation Quote from the page: Examples above will fetch template values through notions like but in case named args is selected values are recognized by variables names like or instead.
Lower case, (e.g. ?population or ?area when ?Population and ?Area is used in the query) would not work in my mediawiki. At least in version MW 1.22.6 (7fe794c) and SMW 1.9.2 (40ea19e). Is that intended or a bug ?
(2) I can't get anything to work in this wiki :( ... but then I may just be tired and there is some small mistake I cannot see:
- Template: Template:Query named output demo
- Example code with cities I planned to insert into this page once it works: Daniel K. Schneider (talk) (on top)
- greetings !
Hello. Template format doesn't work fine when one of the parameters that the ASK query returns are URL type, some of them containing stuff like "http://domain.com?q=aaa&v=1234". I'm not sure how Template format calls to the template, but it doesn't seem MediaWiki alike. In MediaWiki when you call a template and need to pass a URL, you call "{{template|1=http://domain.com?q=aaa&v=1234}}" and works fine.
I don't believe that this is a general problem with the "template" format. Did you try running the same query with, say, the "table" format, to see if the same problem happens there (i.e., the issue is actually with the storing of the data)? If the problem is unique to the "template" format, could you include the relevant portion of your template, that displays the URL?
Templates: http://wiki.15m.cc/wiki/Plantilla:Noticias_por_fuente and http://wiki.15m.cc/wiki/Plantilla:Noticias_por_fuente/row
Page with ask that uses this template: http://wiki.15m.cc/wiki/Lista_de_noticias
You can see the broken external links in some of the rows. All are cases of URLs with '?='.
Could the issue be that you need to a "1=" to the "convertir fecha" template call in that 2nd link?
If this is still a problem, can you log this as an issue here: http://semantic-mediawiki.org/wiki/Help:Reporting_bugs
This:
{{#ask:[[Category:Document]] |?Has Abstract= |?Has Update Date= |sort=Has Update Date |format=template |template=displayDocumentList |link=none |limit=10 |order=desc |columns=3 }}
used to work nicely (SRF 1.5.1), letting me format my document title and place an abstract below it in with a smaller font.
As of Version 1.8, columns are ignored when format=template. I can use format=ul/ol/list with my template, but I can't get rid of the resulting bullet, number, or column that gets added.
Can format=template / columns=# support be restored?
Thanks.
Can you log this as a bug on the dev mailing list please: http://semantic-mediawiki.org/wiki/Help:Reporting_bugs
Why is "further results" always ahown as
non-wiki text
? Or is it a sloppy bug that got introduced fairly recently?
Hello. Basically the "sep" parameter doesn't work with template format. For users wishing to use custom separators between templates, they may use {{#ask: [[Located in::Germany]] | template = formatting template name goes here | format = list | sep = <br>}}
(where the sep argument could be anything).
The example where I observed this behavior was on this page. (MW 1.23.2, SMW 2.0)
Relevant github report here.
I'd like to suggest that in the Usage for named args section the sentence "Note, the question mark is required!" be changed to something like "Note, the question mark is required, even if you supply an alternate name!". This caused me some confusion because when you specify names in a table the question marks are removed from the table, so I assumed parameters sent to templates would work in a similar fashion, but they do not. This behavior seems odd to me because it prevents SMW from using templates that are also meant for normal use by users without modifying those templates to accept alternative parameters with question marks, but that's a discussion for elsewhere. --Sigilbaram (talk) 22:34, 8 April 2015 (CEST)
Maybe I'm missing something (not uncommon) but the article's example template (Template:Query output demo) lists the argument order as
{{{2}}} people squeeze into the {{{3}}} of {{{1}}}.
but shouldn't it be:
{{{3}}} people squeeze into the {{{2}}} of {{{1}}}.
in order to get the stated output? I would simply edit this myself, but I'm new and have no confidence in my technical knowledge of SMW.
> but shouldn't it be: {{{3}}} people squeeze into the {{{2}}} of {{{1}}}.
No, the order is correct because if you look at the data then a subject (1) (such as Amsterdam) has somewhere in its text declared that a population is of "783,364" within an area of "219 km²". (The order of the annotation that appears in a subject has no relevance but the order in the ask query determines its position for the template placeholder.)
The ask query:
{{#ask: [[Category:City]] [[Area::+]] [[Population::+]] -> (1) | ?Population=Inhabitants -> (2) | ?Area#km²=Size in km² -> (3) ...
will contain the subject at position (1), the population at (2), and the area at (3) hence the positional fix when "{{{2}}} people squeeze into the {{{3}}} of {{{1}}" gets answered. The template output will generate " 783,364 people squeeze into the 219 km² of Amsterdam.".
> I would simply edit this myself, but I'm new and have no confidence in my technical knowledge of SMW.
If you are unsure about what works and what doesn't, you are welcome to use [0] for such experiments. Don't be a stranger if comes to testing or questions and of course some documentation will need a nudge to make it easier for the less experienced users to find its way around SMW but here we are counting on users like you that with the help of a fresh pair of eyes can improve the situation.
I am trying to use the Template format type with intro and outro to create an #expr that adds up the results of my semantic query, but the #expr just prints out as text, it does not execute. It's a simple move to just add the list of property ranks from a valuerank query. I felt like I pulled it off, but I just wind up with this:
{{#expr: 0 + 14 + 5 + 4 + 3 + 3}}
Is it possible to get this expression to execute and give me a total number as the printou while using the template format? or is there a better way to add up the instances of a Property printout and get a total count? I am all ears.
> #expr just prints out as text, it does not execute
I'm guessing (the description isn't clear about this) that you are using the template to generate an output similar to Intro -> {{#expr: Query -> 0 + 14 + 5 + 4 + 3 + 3 Outro -> }} which will be a text component and not a parser expression (even though it appears as a normal expression).
> to execute and give me a total number as the printou while using the template format?
Demo:Template_with_tabular_output_and_math_functions might help.
The | introtemplate =
feature is not well documented and does not seem to accept templates with paramaters (such as {{Template|option1}}
, for example) Is this correct? Is there a workaround?
That's true. A workaround always depends on what you are trying to do. Do not forget the mailing list but be more verbose.
Short version: It seems like I can't use templates with paramaters in the | introtemplate={{template|param}}
. Is this correct? Is there a workaround?
Long version:
I'm trying to insert a template with paramaters as the introtemplate option. I would like to create a section heading if there are more than zero results returned by the ask query, and not create a section heading if zero results are returned. Here is my code:
The paramater is correctly passed to the template, but the Omitting the braces in the line |
Thanks,
The first example on the page uses this snippet:
template=templatename
Those double quotes are misleading, as they shouldn't be there. It seems to me that this was a copy-paste from a section where templatename was in italics (hence the quotes). Because it's wrapped in a pre tag, these are shown as-is. So I changed that :)