Difference between revisions of "Talk:Test table"
(→Creating a table with list-separators) |
|||
(12 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
+ | == Creating a table with list-separators == | ||
+ | |||
Can I (how can I) use %TITLE%, %COUNT%, etc. with table? --[[User:Dmb|Dmb]] 01:16, 17 September 2007 (CEST) | Can I (how can I) use %TITLE%, %COUNT%, etc. with table? --[[User:Dmb|Dmb]] 01:16, 17 September 2007 (CEST) | ||
− | + | : Inside the phantom template you can use these variables. But you can also use them directly in the DPL statement. [[User:Gero|Gero]] 12:27, 17 September 2007 (CEST). | |
− | Inside the phantom template you can use these variables. [[User:Gero|Gero]] 12:27, 17 September 2007 (CEST) | ||
− | You can even write something like: | + | : You can even write something like: |
<pre><nowiki> | <pre><nowiki> | ||
{{#dpl: | {{#dpl: | ||
|ordermethod=lastedit | |ordermethod=lastedit | ||
− | |namespace= | + | |namespace=DPL |
|order=descending | |order=descending | ||
|addeditdate=true | |addeditdate=true | ||
Line 23: | Line 24: | ||
}} | }} | ||
</nowiki></pre> | </nowiki></pre> | ||
− | This will give you the latest modifications in the main namespace and in Talk in a nice format. | + | |
+ | : This will give you the latest modifications in the main namespace and in Talk in a nice format. The link will open the diff in a new window. | ||
{{#dpl: | {{#dpl: | ||
|ordermethod=lastedit | |ordermethod=lastedit | ||
− | |namespace= | + | |namespace=DPL |
|order=descending | |order=descending | ||
|addeditdate=true | |addeditdate=true | ||
Line 40: | Line 42: | ||
|count=20 | |count=20 | ||
}} | }} | ||
+ | |||
+ | :: The URL part for the listseparators might be re-written as '''<nowiki>[http://{{SERVERNAME}}/dpldemo/index.php?title=²{urlencode:%PAGE%}²&diff %PAGE%]</nowiki>''' --[[User:Nakohdo|nakohdo]] 17:19, 17 June 2011 (CEST) | ||
+ | |||
+ | == Table with a column for each article? == | ||
+ | |||
+ | How can I create a table with a column for each article? I have tested with [[Table#columns]], but it did not work for me. Thank you --[[User:Pdcemulator|Pdcemulator]] 08:44, 12 July 2010 (UTC) | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | '''Name''' | ||
+ | | [[Some Article 1]] | ||
+ | | [[Some Article 2]] | ||
+ | | [[Some Article 3]] | ||
+ | |- | ||
+ | | '''Value 1''' | ||
+ | | some value 1-1-1 | ||
+ | | some value 2-1-1 | ||
+ | | some value 3-1-1 | ||
+ | |- | ||
+ | | '''Value 3''' | ||
+ | | some value 1-3-1 | ||
+ | | some value 2-3-1 | ||
+ | | some value 3-3-1 | ||
+ | |} | ||
+ | |||
+ | :I am afraid there is no way to do this with DPL. DPL walks through the articles and tables are built line-wise, nbot column-wise. Maybe you can find a MW extension which flips a table as a whole? In that case you could wrap the DPL call by that extension. [[User:Gero|Gero]] 20:56, 13 July 2010 (UTC) | ||
+ | |||
+ | ::If you have the [http://www.mediawiki.org/wiki/Extension:VariablesExtension VariablesExtension] installed, you can make a query and store the results in <code>variablename%NR%</code> for each matching page. Afterwards use these variables in a standard wikitable: | ||
+ | {{#dpl: | ||
+ | | ordermethod = lastedit | ||
+ | | namespace = DPL | ||
+ | | order = descending | ||
+ | | addeditdate = true | ||
+ | | addcategories = true | ||
+ | | adduser = true | ||
+ | | addpagesize = true | ||
+ | | titlematch = % | ||
+ | | mode = userformat | ||
+ | | lastrevisionbefore = 3000 | ||
+ | | count = 3 | ||
+ | | format = ,,²{#vardefine:page%NR%¦[http://{{SERVERNAME}}/dpldemo/index.php?title=%NAMESPACE%:²{#urlencode:%TITLE%}²&action=history %TITLE%]}²²{#vardefine:categories%NR%¦%CATNAMES%}²²{#vardefine:date%NR%¦%DATE%}²²{#vardefine:user%NR%¦%USER%}²²{#vardefine:size%NR%¦%SIZE%}², | ||
+ | }}{| class="wikitable" | ||
+ | |- | ||
+ | | '''article''' | ||
+ | | {{#var:page1}} | ||
+ | | {{#var:page2}} | ||
+ | | {{#var:page3}} | ||
+ | |- | ||
+ | | '''categories''' | ||
+ | | {{#var:categories1}} | ||
+ | | {{#var:categories2}} | ||
+ | | {{#var:categories3}} | ||
+ | |- | ||
+ | | '''date''' | ||
+ | | {{#var:date1}} | ||
+ | | {{#var:date2}} | ||
+ | | {{#var:date3}} | ||
+ | |- | ||
+ | | '''author''' | ||
+ | | {{#var:user1}} | ||
+ | | {{#var:user2}} | ||
+ | | {{#var:user3}} | ||
+ | |- | ||
+ | | '''size''' | ||
+ | | {{#var:size1}} | ||
+ | | {{#var:size2}} | ||
+ | | {{#var:size3}} | ||
+ | |} | ||
+ | ::note: in this example, variablenames are hard-coded; you can also do something like a [http://www.mediawiki.org/wiki/Extension:Loops loop] --[[User:WiMu|WiMu]] 14:58, 14 July 2010 (UTC) | ||
+ | |||
+ | |||
+ | == Using parameters == | ||
+ | |||
+ | I would like do something like this: | ||
+ | <nowiki> | ||
+ | |namespace=Glossary | ||
+ | |include= {Some Template}:parm1:parm2:[[parm3|parm4]] | ||
+ | </nowiki> | ||
+ | I have created a namespace for a Glossary and would like to use one parameter as an internal link to some article elsewhere in the Wiki. | ||
+ | |||
+ | The whole thing works for the first two parms, but of course not for the internal links. How could that be done? Im thinking of something like "replace parm4 by <nowiki>[[parm3|parm4]]</nowiki>" but do not know how and at which place to get the parm into a regular expression ... | ||
+ | |||
+ | --[[User:Bescheid|Bescheid]] 15:57, 20 July 2010 (UTC) | ||
+ | |||
+ | :You should use a phantom template. See the manual and various examples available here. Within that template you can do whatever you want with the parameters. See the example below: | ||
+ | {{#dpl: | ||
+ | |titlematch=Some Article % | ||
+ | |include = {Some Template}.dpl3 | ||
+ | |table = ,,T1 - p1, T1 - p2, link | ||
+ | }} | ||
+ | .[[User:Gero|Gero]] 05:30, 21 July 2010 (UTC) |
Latest revision as of 16:24, 17 June 2011
Creating a table with list-separators
Can I (how can I) use %TITLE%, %COUNT%, etc. with table? --Dmb 01:16, 17 September 2007 (CEST)
- Inside the phantom template you can use these variables. But you can also use them directly in the DPL statement. Gero 12:27, 17 September 2007 (CEST).
- You can even write something like:
{{#dpl: |ordermethod=lastedit |namespace=DPL |order=descending |addeditdate=true |addcategories=true |adduser=true |addpagesize=true |mode=userformat |titlematch=% |lastrevisionbefore=3000 |listseparators=¶{¦class="sortable" ¶!article ¶!categories ¶!date ¶!author ¶!size,¶¦-¶¦[http://{{SERVERNAME}}/dpldemo/index.php?title=%NAMESPACE%:²{#urlencode:%TITLE%}²&action=history %TITLE%]¶¦<small>%CATNAMES%</small>¶¦%DATE%¶¦%USER%¶¦%SIZE%,¶,¶¦} |secseparators=\n¦ |count=20 }}
- This will give you the latest modifications in the main namespace and in Talk in a nice format. The link will open the diff in a new window.
- The URL part for the listseparators might be re-written as [http://{{SERVERNAME}}/dpldemo/index.php?title=²{urlencode:%PAGE%}²&diff %PAGE%] --nakohdo 17:19, 17 June 2011 (CEST)
Table with a column for each article?
How can I create a table with a column for each article? I have tested with Table#columns, but it did not work for me. Thank you --Pdcemulator 08:44, 12 July 2010 (UTC)
Name | Some Article 1 | Some Article 2 | Some Article 3 |
Value 1 | some value 1-1-1 | some value 2-1-1 | some value 3-1-1 |
Value 3 | some value 1-3-1 | some value 2-3-1 | some value 3-3-1 |
- I am afraid there is no way to do this with DPL. DPL walks through the articles and tables are built line-wise, nbot column-wise. Maybe you can find a MW extension which flips a table as a whole? In that case you could wrap the DPL call by that extension. Gero 20:56, 13 July 2010 (UTC)
- If you have the VariablesExtension installed, you can make a query and store the results in
variablename%NR%
for each matching page. Afterwards use these variables in a standard wikitable:
- If you have the VariablesExtension installed, you can make a query and store the results in
{{#vardefine:page1|- Source and Installation}}&action=history Manual - Source and Installation}}{{#vardefine:categories1|DPL Manual}}{{#vardefine:date1|2015-06-11 19:17:55}}{{#vardefine:user1|Maiden taiwan}}{{#vardefine:size1|13262}}{{#vardefine:page2|using DPL}}&action=history Websites using DPL}}{{#vardefine:categories2|DPL}}{{#vardefine:date2|2015-03-24 21:54:25}}{{#vardefine:user2|Bernd}}{{#vardefine:size2|15299}}{{#vardefine:page3|- DPL parameters: Criteria for page selection}}&action=history Manual - DPL parameters: Criteria for page selection}}{{#vardefine:categories3|DPL Manual}}{{#vardefine:date3|2015-02-11 22:40:41}}{{#vardefine:user3|Capmo}}{{#vardefine:size3|45961}}{| class="wikitable" |- | article | {{#var:page1}} | {{#var:page2}} | {{#var:page3}} |- | categories | {{#var:categories1}} | {{#var:categories2}} | {{#var:categories3}} |- | date | {{#var:date1}} | {{#var:date2}} | {{#var:date3}} |- | author | {{#var:user1}} | {{#var:user2}} | {{#var:user3}} |- | size | {{#var:size1}} | {{#var:size2}} | {{#var:size3}} |}
Using parameters
I would like do something like this:
|namespace=Glossary |include= {Some Template}:parm1:parm2:[[parm3|parm4]]
I have created a namespace for a Glossary and would like to use one parameter as an internal link to some article elsewhere in the Wiki.
The whole thing works for the first two parms, but of course not for the internal links. How could that be done? Im thinking of something like "replace parm4 by [[parm3|parm4]]" but do not know how and at which place to get the parm into a regular expression ...
--Bescheid 15:57, 20 July 2010 (UTC)
- You should use a phantom template. See the manual and various examples available here. Within that template you can do whatever you want with the parameters. See the example below:
Content page | T1 - p1 | T1 - p2 | link |
---|---|---|---|
Some Article 6 | {{{parm1}}} | {{{parm2}}} | linking to [[{{{parm1}}}|{{{parm2}}}]] |
Some Article 4 | {{{parm1}}} | {{{parm2}}} | linking to [[{{{parm1}}}|{{{parm2}}}]] |
Some Article 5 | some value 5-1-1 | some value 5-1-2 | linking to some value 5-1-2 |
Some Article 3 | some value 3-1-1 | some value 3-1-2 | linking to some value 3-1-2 |
Some Article 3 | some value 3-2-1 | some value 3-2-2 | linking to some value 3-2-2 |
Some Article 2 | {{{parm1}}} | {{{parm2}}} | linking to [[{{{parm1}}}|{{{parm2}}}]] |
Some Article 1 | some value 1-1-1 | some value 1-1-2 | linking to some value 1-1-2 |
Some Article 1 | some value 1-2-1 | some value 1-2-2 | linking to some value 1-2-2 |
Some Article 1 | some value 1-3-1 | some value 1-3-2 | linking to some value 1-3-2 |
.Gero 05:30, 21 July 2010 (UTC)