Difference between revisions of "DPL:Requests for new features"

From FollowTheScore
Jump to: navigation, search
 
(57 intermediate revisions by 10 users not shown)
Line 1: Line 1:
__TOC__
+
----
 +
<big>
 +
This page is no longer in use. If you think one of the issues mentioned below is still relevant, go to [[:Category:Issue]] and create a new Issue (with type=''Change Request'' and status=''open'') there.
 +
</big>
 +
----
  
::''Please add requests for new features <font color=red> at the beginning</font> of this document. If possible make syntax suggestions and give an example for the desired behaviour!''
+
 
 +
__TOC__ __NEWSECTIONLINK__
  
 
::''Old requests (which have been resolved) can be found in the [[DPL:Requests for new features Archive]].
 
::''Old requests (which have been resolved) can be found in the [[DPL:Requests for new features Archive]].
Line 44: Line 49:
 
:After some investigation I feel that it would be very slow and resource consuming to build that feature. '''If somebody can come up with a SQL statement''' which delivers the basic data we want to show: fine (I don´t know how to do it with pure SQL). Otherwise one would have to call diff3 for each document. That´s a show stopper. [[User:Gero|Gero]] 14:52, 15 August 2007 (CEST)
 
:After some investigation I feel that it would be very slow and resource consuming to build that feature. '''If somebody can come up with a SQL statement''' which delivers the basic data we want to show: fine (I don´t know how to do it with pure SQL). Otherwise one would have to call diff3 for each document. That´s a show stopper. [[User:Gero|Gero]] 14:52, 15 August 2007 (CEST)
  
==Template call escaping in output==
+
:: Hello Gero, and sorry for taking so long to reply. Here is the SQL that I have come up with. I think that it does the job (more or less).
Example:
 
...
 
|listseparators=...,[{!-fullurl:%PAGE%¦diff=%REVISION%-!} diff],...
 
...
 
resulting in DPL output
 
...
 
<nowiki>[{{fullurl:SomeNamespace:Matching_Page¦diff=152}} diff]</nowiki>
 
...
 
and further transformed into a link. The regular form won't work because fullurl would be called '''before''' %PAGE% et al. are substituted.
 
 
 
I implemented this way:
 
$dpl2result = str_replace( '-!}', '}}', str_replace( '{!-', '{{', $dpl2result ));
 
in the // ###### SHOW OUTPUT ###### block. Please tell me if it sounds wrong, dangerous or anything. - [[User:82.252.29.95|82.252.29.95]] 16:49, 10 August 2007 (CEST)
 
 
 
:The next DPL release (1.3.2) will have a mechanism which '''optionally postpones template expansion''' to the moment after the execution of the query. It will be similar to the twin angle brackets now used for delayed tag expansion. This will make '''nested DPL calls''' possible plus applications like the one above. In fact it really opens a door to more creative applications of DPL. Somewhen next week ... [[User:Gero|Gero]] 00:00, 11 August 2007 (CEST)
 
 
 
==<nowiki><noinclude></nowiki> support==
 
  
No idea if this is a bug or not so I'm putting this here.
+
<pre>
 +
SELECT
 +
  rc_title, rc_cur_id, rc_user_text, rc_user,
 +
  GROUP_CONCAT(rc_new_len - rc_old_len) AS DEBUG,
 +
  SUM(ABS(rc_new_len - rc_old_len)) AS CONTRIB
 +
FROM
 +
db_prefix_categorylinks  cl
 +
INNER JOIN
 +
  db_prefix_recentchanges rc
 +
ON
 +
  cl.cl_from = rc.rc_cur_id
 +
WHERE
 +
  cl_to='Some_category'
 +
GROUP BY
 +
  rc_cur_id, rc_user
 +
;
 +
</pre>
  
We use DPL over at the Sawfish wiki to automatically generate [http://sawfish.wikia.com/wiki/News a page 'News'] containing all pages in our [http://sawfish.wikia.com/wiki/Category:News News category]. This results in the News page becoming a member of the News category itself. It would be nice if we could prevent this from happening by writing something like this:
+
Using the above we get to see which user has done the most 'editing' of a page in the given category. The notion of 'editing' implemented above is quite crude, but I can't think of any better systematic way to do it (SQL or otherwise). The contributors option would take a threshold parameter to delineate the valid list of 'significant contributors' - that parameter could even be a fraction of the page size! Anyway, lemmy know if this is what you were looking for, and if not why not.
  
<nowiki><noinclude>[[Category:News]]</noinclude></nowiki>
+
Thanks for the brilliant extension!
  
on the pages that get included. --[[User:Sven Schoenung|Sven Schoenung]] 20:53, 31 July 2007 (CEST)
+
P.S. I wonder if we could apply a modified version of the above to look at the 'most active pages' request above?
 
 
:It´s not a feature, it´s a 'standard' consequence of the wiki parsing process - and it is most times quite unwanted...
 
:The next release will contain a 'reset option' which prevents mediawiki from creating category links for transcluded text (the same happens with images and templates by the way). Sometimes you even don´t want the normal hyperlinks of a DPL query result to be recorded in the mediawiki database. There will be a switch for that as well.
 
:[[User:Gero|Gero]] 23:47, 14 August 2007 (CEST)
 
  
 +
::--[[User:Dmb|Dmb]] 13:53, 14 September 2007 (CEST)
  
 
==Table row/column header switch==
 
==Table row/column header switch==
Line 83: Line 84:
 
::I'm not a programmer, Gero...I just have ideas and what I want to do programmatically that I can already do (and have done for years) manually. Perhaps creating a "table" mode that deals with all table-related parameters like <tt>header</tt> (and <tt>column</tt>/<tt>row</tt> types). <tt>resultsfooter</tt> could have an option to be the last row or column of the table and include parameters for totals of a specific header (# articles in table, etc), a number field (like a "sum" function), etc. <tt>cellseparators</tt> could be used instead of <tt>listseparators</tt> (or at least as an alias) and. of course, support for specifying normal/regular non-suffixed template fields. Essentially, DPL needs more table-specific support to move it beyond just lists, per se. -[[User:Eep²|Eep²]] 08:28, 29 July 2007 (CEST)
 
::I'm not a programmer, Gero...I just have ideas and what I want to do programmatically that I can already do (and have done for years) manually. Perhaps creating a "table" mode that deals with all table-related parameters like <tt>header</tt> (and <tt>column</tt>/<tt>row</tt> types). <tt>resultsfooter</tt> could have an option to be the last row or column of the table and include parameters for totals of a specific header (# articles in table, etc), a number field (like a "sum" function), etc. <tt>cellseparators</tt> could be used instead of <tt>listseparators</tt> (or at least as an alias) and. of course, support for specifying normal/regular non-suffixed template fields. Essentially, DPL needs more table-specific support to move it beyond just lists, per se. -[[User:Eep²|Eep²]] 08:28, 29 July 2007 (CEST)
  
 +
:::Still need this too... -[[User:Eep²|Eep²]] 05:40, 11 September 2007 (CEST)
  
 
==Template field output==
 
==Template field output==
Line 136: Line 138:
 
the incudepage feature could be enhanced to include the TOC only; a %TOC% variable would ebe useful ...
 
the incudepage feature could be enhanced to include the TOC only; a %TOC% variable would ebe useful ...
  
==Better error handling==
+
==Putting delimiters between results==
"%DPL-1.2.5-WARNING: No results!" is a tad bit vague (note the sarcasm). -[[User:Eep²|Eep²]] 12:40, 24 July 2007 (CEST)
 
:What do you expect instead? Did you notice the 'noresultsheader' option? [[User:Gero|Gero]] 20:30, 24 July 2007 (CEST)
 
 
 
::Something like "no <tt>noresultsheader</tt> specified" or something. Even if you submit a default "report" (without changing anything), DPL just goes right back to the same screen without even saying anything is wrong. Basic javascript error-checking would be good without requiring a many server-hit response. Why does DPL cause so many server hits anyway? Seems like every page takes at least 10 hits before it finally shows up anyway (status bar flashes like mad)... -[[User:Eep²|Eep²]] 21:44, 24 July 2007 (CEST)
 
 
 
The 'noresultsheader' option works nicely for me. However, what about the ''There are 0 results'', ''There is 1 result'' and ''There are 2 results''... problem? How about 'oneresultheader'? This is actually a real and somewhat pressing issue.&nbsp;&nbsp;&mdash;&nbsp;[[User:Frank|Frank]] 10:15, 09 August 2007 (EDT)
 
 
 
:The next release will have a 'oneresultheader' option. [[User:Gero|Gero]] 23:13, 14 August 2007 (CEST)
 
  
 
::Will this solve a related formatting problem - putting delimiters only ''between'' results? Ideally I'd like to have a single result returned inline, but multiple results in an ordered list. It could be I misunderstood the documentation, but there doesn't seem to be a way to avoid a leading bullet or whatever in a list. [[User:Frank|Frank]] 14:35, 20 August 2007 (EDT)
 
::Will this solve a related formatting problem - putting delimiters only ''between'' results? Ideally I'd like to have a single result returned inline, but multiple results in an ordered list. It could be I misunderstood the documentation, but there doesn't seem to be a way to avoid a leading bullet or whatever in a list. [[User:Frank|Frank]] 14:35, 20 August 2007 (EDT)
  
 +
::: There is a mode called 'inline' which does what you want. You can define the 'inline' tag contents. [[User:Gero|Gero]] 07:50, 10 September 2007 (CEST)
 +
:::{{#dpl:category=Country|mode=inline|inlinetext= &nbsp; my separator &nbsp;}}
  
 
== Hook based data exchange between extensions ==
 
== Hook based data exchange between extensions ==
Line 171: Line 167:
 
=== Reply ===
 
=== Reply ===
  
Why don´t you just go ahead with DPL as it is? You can put any call of a parser function into the output loop of DPL. And you can use DPL in a way that it does not produce any single byte of output on its own. You can easily create ''title objects'' within your code from the first parameter which is passed to''my working template''. You might say that this is less efficient than an integration on php level but before trying to optimise you could build your extension right now without any change to DPL and without any code interference. '''What kind of application do you have in mind, by the way?.'''
+
Why don´t you just go ahead with DPL as it is? You can put any call of a parser function into the output loop of DPL. And you can use DPL in a way that it does not produce any single byte of output on its own. You can easily create ''title objects'' within your code from the first parameter which is passed to ''my working template''. You might say that this is less efficient than an integration on php level but before trying to optimize you could build your extension right now without any change to DPL and without any code interference. '''What kind of application do you have in mind, by the way?.'''
 
For example:
 
For example:
 
<pre><nowiki>
 
<pre><nowiki>
Line 184: Line 180:
  
 
--[[User:Gero|Gero]] 07:28, 10 September 2007 (CEST)
 
--[[User:Gero|Gero]] 07:28, 10 September 2007 (CEST)
 +
 +
:I've been toying around with DPL a bit with some of the examples on this site, and I see now that it can do what I want it to do.  Excellent!  I'm trying to be able to take user-supplied information from a page.  In fact, the table on the [[Main Page|main page]] with the headers "Country", "Area", "Population", "Text", and "#hits" is a perfect example of what I want to do. (The answer was in front of me all along.)
 +
 +
:I still would definitely like to see an API layout to the code, even more so now.  There are some really nice nuggets of functionality that would be useful as a suite of API tools and/or could be made into extensions in their own right, and if the code were in such a format, it'd be easier to pull out those bits of interest.
 +
 +
:In fact, I'd like to see the mechanic in the aforementioned example in a form I can use outside of DPL.  Also, I'd like to get my hands on that bit of code that utilizes the character escapes to prevent templates, magic words, tags, and other parser functions from being parsed before they're ready to be.  —[[User:Sledged|Sledged]] ([[User talk:Sledged|talk]]) 00:25, 15 September 2007 (CEST)
 +
 +
::I understand. In fact I had to solve a couple of hairy problems to offer the full power which DPL has right now. I suggest the following: You create one or more modular pieces by lending code from the current source. Thus we have one or more independently usable extensions/modules. Once they are tested and their interfaces have stabilized I will refactor the current DPL code to make use of the new module(s). Although this will create dependencies BETWEEN extensions I think it is the right way to go for. Before you start extracting pieces of the code you should wait for version 1.4.2 as it will have some interesting new features regarding table handling. Internally it tries to solve some really hard problems regarding interaction with the mediawiki parser and its book-keeping on references. [[User:Gero|Gero]] 09:12, 22 September 2007 (CEST)
 +
 +
:::Here's my first installment:  [[mw:Extension:Character Escapes|Character Escapes]].  I'm appalled at how simple that solution is and that no one has applied it to [http://meta.wikimedia.org/wiki/ParserFunctions ParserFunctions].  It doesn't use the escapes you've defined [[DPL:Manual - General Usage and Invocation Syntax#Characters with special meaning|here]], because it doesn't work well with heavy nesting.  So instead of trying to find a workaround with what you've defined, I used the convention commonly used in programming languages (i.e. the backslash).  —[[User:Sledged|Sledged]] ([[User talk:Sledged|talk]]) 06:50, 25 September 2007 (CEST)
 +
 +
==<tt>redirects</tt> include pages that ''link'' to redirects==
 +
See [[DPL:Discussion#Redirects to include pages that link to them?]] -[[User:Eep²|Eep²]] 05:07, 13 August 2007 (CEST)
 +
 +
:My final statement regarding this topic is in the [[DPL:FAQ|FAQ}}. [[User:Gero|Gero]] 10:31, 23 September 2007 (CEST)
 +
 +
::Can't you just add a simple parameter to <tt>redirects</tt> (like "<tt>strict</tt>") that does this automatically without requiring complicated nested queries? -[[User:Eep²|Eep²]] 10:39, 23 September 2007 (CEST)
 +
 +
==<tt>linksto</tt> and other parameter case-insensitivity option==
 +
I need this without having to manually specify lower-/upper-case versions of every page... -[[User:Eep²|Eep²]] 13:29, 2 September 2007 (CEST)
 +
 +
:Mediawiki is case-sensitive by nature. So I can´t see what this should be good for ... Abc is the same as abc but is different from aBc and abC. DPL works on internal page_id numbers and these only exist for existing articles. [[User:Gero|Gero]] 14:31, 2 September 2007 (CEST)
 +
 +
::Why must you fight me at every point in getting new features in DPL to make it easier to use, Gero? Geez. "Abc" is ''not'' the same as "abc" if <tt>$wgCapitalLinks = false;</tt> is set in localsettings.php, as I have it set in my wiki. I use DPL to list redirects but it requires a lot of variations on the page and support for multiple manually-entered parameters:
 +
 +
<pre><nowiki>
 +
|linksto={{FULLPAGENAME}}{{!}}{{FULLPAGENAME}}s{{!}}{{FULLPAGENAME}}es{{!}}{{FULLPAGENAME}}ies{{!}}{{FULLPAGENAME}}ing{{!}}{{FULLPAGENAME}}ed{{#if:{{{2}}}|{{!}}{{{2}}}{{!}}{{{2}}}s|}}
 +
</nowiki></pre>
 +
 +
::This query doesn't have any problem if any of these pagename variations don't exist so why would <tt>linksto</tt> have a problem with pagename case variations either??
 +
::Is this like how you couldn't see what "on"/"off" and "1"/"0" for boolean operators is good for? Or why someone would want to create table columns vs. rows (as I want for each game in my [http://tnlc.com/eep/compare/table.html comparison table])? It's like the [[#redirects include pages that link to redirects|<tt>redirect</tt> issue]] you have been resisting and how MediaWiki devs resist adding suffix index ([[Special:Prefixindex]] in reverse) despite DPL being able to do it easily enough using a simple wildcard <tt>titlematch</tt> query (see http://www.tnlc.com/wiki/index.php?title=fire for an example). Enhancements like these make MediaWiki (and DPL) easier (and less frustrating) to use... -[[User:Eep²|Eep²]] 15:38, 2 September 2007 (CEST)
 +
 +
::I really need this functionality, since trying to create case variations for all of the above redirect variations (PLUS creating the actual redirects!) is a tad big annoying... -[[User:Eep²|Eep²]] 05:40, 11 September 2007 (CEST)
 +
 +
::Hello? -[[User:Eep²|Eep²]] 12:40, 22 September 2007 (CEST)
 +
 +
:::Version 1.4.2 will have an 'ignorecase' switch. It will have an effect upon 'linksto', 'titlematch', and 'uses', but due to technical reasons not upon 'linksfrom' or any other DPL parameter. [[User:Gero|Gero]] 10:34, 23 September 2007 (CEST)
 +
 +
::::OK, thanks--better than nothing. ;) -[[User:Eep²|Eep²]] 10:39, 23 September 2007 (CEST)
 +
 +
== DPL doesn't respect $wgNonincludableNamespaces ==
 +
I'm using the [http://www.mediawiki.org/wiki/Extension:Lockdown Lockdown] extension to restrict read access to a certain namespace to one group of users only. Part of restricting read access is preventing page inclusion by namespace. DPL allows one to bypass this.
 +
 +
As a suggestion, if you're able to fix this, could you make it so that with DPL it'd be possible to include / transclude pages ''within'' a nonincludable namespace, but not ''across'' namespaces? E.g. if I set NS_PROJECT to be non-includable, it'd still be possible to include NS_PROJECT content on NS_PROJECT pages, but not on main namespace etc. pages.
 +
 +
Thanks. [[User:212.149.229.126|212.149.229.126]] 15:48, 11 September 2007 (CEST)
 +
 +
:Do you think that DPL is wide-spread enough so that it is worth the effort? Is Mediawiki as a whole going to offer consistent support for such protection mechanisms and more elaborated access rights? --[[User:Gero|Gero]] 22:07, 11 September 2007 (CEST)
 +
 +
::I have no idea how much effort would it take :) DPL's been actively developed for some time, so I thought I'd ask. I do realize Mediawiki isn't supposed to be a proper CMS with proper read access rules and so forth, so the private information wouldn't be ''that'' sensitive. In any case, it seems a bit too easy if it's accessible simply by using DPL. At the moment, there's no reason why I absolutely must use DPL, nor is there a reason why I absolutely must have read protected wiki pages. If the feature's very difficult to add, I'll just figure out which of the two, using DPL or having read restricticted wiki pages, save me more time. Thanks. [[User:212.149.229.126|212.149.229.126]] 22:58, 11 September 2007 (CEST)
 +
 +
 +
== Integrating templates==
 +
Hi Gero! By this time, if we want to collect data in many articles using a template, like [[Example 1]], we have to use the descriptions like followed:
 +
includepage={Country} dpl,#History,#Religion[20],revolution
 +
Could it be possible we could use them like followed:
 +
includepage={Country} __,name,capital,dial__,#History,#Religion[20],revolution
 +
or
 +
includepage={Country} {{{,name,capital,dial}}},#History,#Religion[20],revolution
 +
Then we would use [[Template:Catlist|Catlist]] to collect data.
 +
Because I am trying to develop the GUI of Catlist. Please see [[template:Catlist/test]]. I've added some elements like offset, include, table class and Title of column in it. But I still want to integreat all the templates in the one. The change which I ask for is come from new command [[Test table|table]].
 +
 +
By the way, I am afraid that [[template:Catlist/test]] use Get instead of Post. Could it be possible it would be disabled by passing too many data?
 +
Thank you!
 +
--[[User:Roc michael|Roc michael]] 04:32, 16 September 2007 (CEST)
 +
 +
::Gero, sorry! I'v seen the Eep²'s case like followed:
 +
|includepage={game}:year,{game}:genre,{game}:publisher,{game}:developer,{game}:engine,{game}:character
 +
::It also seems to be great!
 +
--[[User:Roc michael|Roc michael]] 13:39, 16 September 2007 (CEST)
 +
 +
:::Not really. As I've mentioned to Gero before (though I can't find where it's documented), it would be better if it could be declared like <tt>|includepage={game}:year,genre,publisher,developer,engine,character</tt> (or perhaps with colons vs. commas) without having to duplicate <tt>{game}</tt> for ''every'' parameter. -[[User:Eep²|Eep²]] 15:10, 16 September 2007 (CEST)
 +
 +
::::I have a tendency towards the following syntax:
 +
|include={myTemplate}:parm1:parm2:parm3
 +
::::it could behave like the parameter list in the 'table' statement. It would deliver each parameter as acolumn of a row. What do you think? [[User:Gero|Gero]] 17:30, 16 September 2007 (CEST)
 +
 +
:::::Sounds good. Would there be a way to optionally deliver each parameter as a row of a column too? I still want to have the option of column entries vs. row entries for [http://www.tnlc.com/wiki/index.php?title=Comparison_table my game comparison table] (so it doesn't become unnecessarily wide due to the amount of parameters--I'd rather have longer vertical scrolling)... -[[User:Eep²|Eep²]] 07:32, 17 September 2007 (CEST)
 +
 +
== You have %USER% and adduser=true, what about %AUTHOR% to go with addauthor and %EDITOR% to go with addlasteditor ? ==
 +
 +
I realize that if addauthor = true, then %USER% is set to the author, but I want to create a table of data per page that includes both the most recent editor and the page author (first editor). For this we need the %AUTHOR% 'magic workd'.
 +
 +
Man ... so many things about DPL are confusing! I think the [[adduser]] option (first/last editor depending on ordermehtod) should be clarified wrt. [[addauthor]] and [[addlasteditor]]. The description of adduser actually talks about dates!
 +
 +
:-D --[[User:Dmb|Dmb]] 01:49, 17 September 2007 (CEST)
 +
 +
== Specific enhancements for 'table from template' DPL ==
 +
 +
I think a very commonly needed and natural use of the DPL is the 'table from template' DPL. I would like to suggest the following syntax to make it easier to generate such DPL output...
 +
 +
<pre>
 +
...
 +
incude = {Some template}:parameterOne
 +
incude = {Some template}:parameterTwo
 +
incude = {Some template}:parameterThree
 +
tablehead =  Title,            One,            Two,            Three
 +
tablebody = %TITLE%, %parameterOne%, %parameterTwo%, %parameterThree%
 +
...
 +
</pre>
 +
 +
The above would generate a table of data for the named parameters passed to 'Template:Some template' in the included pages. I really really love the functions provided by DPL, I just find them hard to master! --[[User:Dmb|Dmb]] 18:53, 18 September 2007 (CEST)
 +
 +
=== Reply ===
 +
That´s almost exactly what will be in the next version! But The syntax will look like this:
 +
<pre>
 +
...
 +
include = {Some template}:parameterOne:parameterTwo:parameterThree
 +
table  = ,, One, Two, Three
 +
</pre>
 +
Creating pseudo variables for each column would add new complexity which I try to avoid.
 +
:[[User:Gero|Gero]] 20:13, 18 September 2007 (CEST)
 +
 +
:: I understand why keeping complexity to a minimum is important, but the above solution (clean though it is) is very rigid compared to the flexibility afforded by the use of pseudo variables. Imagine the following, parameterOne is information about the category of the page that I would like to wrap <nowiki>[[:Category:%p1%]]</nowiki>, parameterTwo is an logo pointer that I would like to wrap <nowiki>[[Image:%p2%|200px]]</nowiki> and parameterThree is a website link that I would like to wrap <nowiki>[%p3% homepage]</nowiki>. None of this funn stuff is available via the above syntax (unless I am wrong). I can think of tons of examples where you just want the parameter, just like %TITLE% (or even %AUTHOR% or %EDITOR%). I am really enjoying watching DPL develope, and I realise that it is very easy for me to make suggestions without any clue regarding the underlying complexity, so sorry for sounding critical. The above is just an idea about what could be nice. All the best. --[[User:Dmb|Dmb]] 01:34, 19 September 2007 (CEST)
 +
::: No comment? --[[User:Dmb|Dmb]] 21:04, 19 September 2007 (CEST)
 +
:::: I´m afraid of the work ;-). The idea is very good, no doubt. Could you help with implementation? [[User:Gero|Gero]] 12:52, 20 September 2007 (CEST)
 +
::::: Sorry to hassle you about it, but I was keen to hear your opinion. I can certainly have a look at the source and let you know what I think. I am glad you like the idea :-D --[[User:Dmb|Dmb]] 21:10, 20 September 2007 (CEST)
 +
:::::: That was a real challenge but I think I can come up with a good solution. The next version will contain the following new feature:
 +
<pre><nowiki>
 +
include  = {template}:parm1:parm2:parm3,#some headline
 +
table    = (tableclass),(articlelink),colheader1,colheader2,colheader3,chapter title
 +
tablerow = [[%%|''%%'']],[[Image:%%|200px]],[%% homepage],'''%%'''
 +
</nowiki></pre>
 +
:::::: You will have access to transcluded contents via "%%". This will also be possible for transcluded paragraphs.
 +
:::::: [[User:Gero|Gero]] 08:13, 22 September 2007 (CEST)
 +
 +
==Could I use DPL to collect all the parameters of a template in a list==
 +
HI! Gero.I want to use DPL to collect the parameters defined in a template ,by using a argument of DPL that would be called "temppar" or some what, with the result like followed:
 +
{| width=100%
 +
|width=50% align=center|
 +
<pre>
 +
*param 1
 +
*param 2
 +
*param 3
 +
*param 4
 +
*param...
 +
</pre>
 +
|align=center|
 +
{{#input: type = select
 +
| name = cars
 +
| multiple = 1 |
 +
*param 1
 +
*param 2
 +
*param 3
 +
*param 4
 +
*param 5
 +
}}
 +
|}
 +
Them I would use the result to make a multi-select in the [[Template:Catlist/test]] 'like followed' in the future. Do you think it is possible?--[[User:Roc michael|Roc michael]] 13:46, 19 September 2007 (CEST)
 +
 +
=== Reply ===
 +
I assume that you have many articles which use the same template (t1)? And you want to collect all values for one parameter (xx) of t1 which are used in the template invocations? You can do that with <tt>uses=Template:t1</tt> and <tt>include={t1}:xx</tt>. If it is not a named parameter you can use a number like this <tt>include={t1}:2</tt>. The <tt>format=,,\n,</tt> can be used to output only the values of 'xx' in the calls for 't1', not the article names. The problem is that your list will not be unique; it will contain the same entries as often as they occur in the template calls. Maybe you can find another extension which produces a unique list from a list with multiple identical entries. Probably you also want the paramneter values sorted by their value and not by the occurence in the template calls ...
 +
:[[User:Gero|Gero]] 18:50, 19 September 2007 (CEST)
 +
 +
:Gero, Yes, I want to use the parameters of DPL like <tt>uses=Template:t1</tt> and <tt>include={t1}:xx</tt>. But what I really want to do is to make a GUI to produce the code above. when users ,who don't know DPL Skill or who want to use  DPL function in convenient way, can dependent on it to query the results what they want directly or produce the different kind of DPL-query-strings. Maybe what I want is like followed not the above.
 +
{| width=100%
 +
|width=50% align=center|
 +
<pre>
 +
*param name1 of t1
 +
*param name2 of t1
 +
*param name3 of t1
 +
*param...
 +
</pre>
 +
|align=center|
 +
{{#input: type = select
 +
| name = cars
 +
| multiple = 1 |
 +
*param name1 of t1
 +
*param name2 of t1
 +
*param name3 of t1
 +
*param...
 +
}}
 +
|}
 +
:You are right. On the other hand, I really forget the existence of parameters like <nowiki>{{{1}}},{{{2}}}}</nowiki>, because I don't use them in a template for definition items very often. And they will be a hole of the selection items in my GUI. But since it is popular to definition items with named parameter in a template, I think it's worth to create a function to collect all the parameter names of a template. How do you think?
 +
::--[[User:Roc michael|Roc michael]] 01:44, 20 September 2007 (CEST)
 +
----
 +
I am still not sure whether I understand what you want:
 +
* Do you want to write a DPL query which extracts documentation (like parameter names) from templates?
 +
* Or do you want to analyse actual invocations of templates and find the values used for parameters?
 +
In the first case your template could use a NOINCLUDE section where it calls another template (maybe named 'tpldoc') to describe its parameters. That would be really nice but would require some effort from the authors of templates. 'tpldoc' together with the dpl query could work a little like javadoc..<br>
 +
Analysing the source code of a template just to find which parameters it uses would only give you parameter names, not their semantics. And the names could even be dynamically constructed like <nowiki>{{{{{{name}}}}}}</nowiki>.
 +
[[User:Gero|Gero]] 13:04, 20 September 2007 (CEST)
 +
 +
== Most popular page ==
 +
 +
'''Select by number of views during last n days.'''
 +
 +
This could be either used to generate most popular pages or in conjunction with other conditions to draw attention to not so often wisited pages from certain category etc.
 +
 +
:a) Please sign your contributions.
 +
:b) Is there a way to find out when a page has been visited via a SQL statement in wiki database?
 +
:[[User:Gero|Gero]] 10:37, 23 September 2007 (CEST)
 +
 +
== regex for category ==
 +
 +
Is it possible to use regular expressions for categories? A lot of my categories have highly structured names. [[User:Tobias Conradi|Tobias Conradi]] 21:08, 27 September 2007 (CEST)
 +
 +
:See [[categoryregexp]].
 +
:[[User:Gero|Gero]] 14:25, 3 October 2007 (CEST)
 +
 +
== headings ==
 +
 +
I am trying to use DPL as a more flexible version of [[mw:Extension:Labeled_Section_Transclusion|Labeled Section Transclusion]]. As such my request may not be of broad interest but here it is.
 +
 +
I found no easy way to include the heading as part of the chapter include (i.e. the include=#... feature). The only way that worked for me was to wrap the section with <section begin="foo"/> and <section end="foo"/>. But then, the edit doesn't take the user to the correct place. I'd like the edit to take the user to edit the actual text seen--not the page where the transclusion code shows. --[[User:Matthew|Matthew]] 07:20, 9 October 2007 (CEST)
 +
 +
:If you know the heading you can put it into the output stream yourself (using the <tt>format</tt> statement). If you include the chapter by its position the built-in variable %SECTION% will contain the section title. There is an [[Test include sections by number|example for this]].
 +
:[[User:Gero|Gero]] 20:56, 9 October 2007 (CEST)
 +
 +
== No More Globals ==
 +
 +
Since MediaWiki is slowly moving away from globals (see [http://www.mediawiki.org/wiki/Manual:Global_variables Manual:Global variables]), I recommend that DPL also migrate from both global variables and functions.  Static class members and methods are a reasonable alternative.  —[[User:Sledged|Sledged]] ([[User talk:Sledged|talk]]) 06:18, 10 October 2007 (CEST)
 +
 +
----
 +
You are absolutely right. The code is not very well structured. It grew from an old simple implementation to a rather big piece of code. Although I think it is still maintainable I would prefer some restructuring. Quality of open source products comes from several authors contributing to the same source (ideally ..). Would you want to start the restructuring effort? You could download the current sources, make the appropriate changes and then upload again within a time frame of, say four weeks...
 +
[[User:Gero|Gero]] 08:39, 10 October 2007 (CEST)

Latest revision as of 19:11, 12 October 2007


This page is no longer in use. If you think one of the issues mentioned below is still relevant, go to Category:Issue and create a new Issue (with type=Change Request and status=open) there.



Old requests (which have been resolved) can be found in the DPL:Requests for new features Archive.


Include other wiki pages

I want to include parts of Wikipedia articles on my wiki. Can DPL be expanded to do this? -Eep² 10:22, 20 August 2007 (CEST)

I don´t think so. Every wiki has its own categories, templates, images,.... So just transcluding the raw text (if it is available via &action=view) would not make much sense. And transclusion of rendered html text is not possible nor desirable either. Gero 14:28, 20 August 2007 (CEST)
And yet many websites (like http://encyclopedia.thefreedictionary.com/) do it all the time without any apparent problems (and there's even a WordPress plugin)... All I really want to pull in is the first paragraph; I don't need templates, categories, or even images. Links can obviously be pulled in easily enough that go to the correct place (Wikipedia or external links). See http://www.killertux.com/pages/Wikipedia_Simple_API.php?q=node/44 too for a "screen scraper" with PHP code you may be able to implement in DPL. -Eep² 15:19, 20 August 2007 (CEST)
Using the killertux API you can yourself include a whole wikipedia article into your wiki (as html or text). I can´t see what DPL should do in that context. DPL cannot and will not parse such scraped contents. You would have to build a completely separate and different mediawiki extension for that purpose. Gero 20:17, 22 August 2007 (CEST)


Most active page?

ordermethod=activity

Most number of edits or biggest diffs in the last t units of time???

--Dmb 18:11, 10 August 2007 (CEST)

The sheer number of edits is not very meaningful; and as soon as 'significance of change' comes into play, I see no way to implement such a feature without having to calling diff3 on every document. And that is definitely too resource consuming. Gero 14:55, 15 August 2007 (CEST)

Add 'contributors'?

addcontributors = TRUE contribthresh = x Kb

Instead of listing one page author or the last editor, addcontributor would add the users who had made significant diffs to the article, where significant is determined by contribthresh. The multiple names are listed separated by commas.

Woop!

--Dmb 18:11, 10 August 2007 (CEST)

That´s a pretty good idea. Maybe I will add that somewhen. Gero 23:56, 10 August 2007 (CEST)

I also thought of another idea... List users by total contrib size. Its a bit 'lets see who has the biggest penis' - but could be useful to see who has contributed most to a certain page or category. --Dmb 08:21, 14 August 2007 (CEST)

After some investigation I feel that it would be very slow and resource consuming to build that feature. If somebody can come up with a SQL statement which delivers the basic data we want to show: fine (I don´t know how to do it with pure SQL). Otherwise one would have to call diff3 for each document. That´s a show stopper. Gero 14:52, 15 August 2007 (CEST)
Hello Gero, and sorry for taking so long to reply. Here is the SQL that I have come up with. I think that it does the job (more or less).
SELECT
  rc_title, rc_cur_id, rc_user_text, rc_user,
  GROUP_CONCAT(rc_new_len - rc_old_len) AS DEBUG,
  SUM(ABS(rc_new_len - rc_old_len)) AS CONTRIB
FROM
 db_prefix_categorylinks  cl
INNER JOIN
  db_prefix_recentchanges rc
ON
  cl.cl_from = rc.rc_cur_id
WHERE 
  cl_to='Some_category'
GROUP BY
  rc_cur_id, rc_user
;

Using the above we get to see which user has done the most 'editing' of a page in the given category. The notion of 'editing' implemented above is quite crude, but I can't think of any better systematic way to do it (SQL or otherwise). The contributors option would take a threshold parameter to delineate the valid list of 'significant contributors' - that parameter could even be a fraction of the page size! Anyway, lemmy know if this is what you were looking for, and if not why not.

Thanks for the brilliant extension!

P.S. I wonder if we could apply a modified version of the above to look at the 'most active pages' request above?

--Dmb 13:53, 14 September 2007 (CEST)

Table row/column header switch

Can the table headers be used as the beginning of rows instead of at the top of columns? I would like to duplicate my game comparison table and need this functionality. -Eep² 05:43, 29 July 2007 (CEST)

Please give more details: How should the new switch be named, which values be allowed? In which modes should it have an effect and how should the result be affected?
For information: There will be no changes to the DPL sources within the next three weeks. Gero 08:13, 29 July 2007 (CEST)
I'm not a programmer, Gero...I just have ideas and what I want to do programmatically that I can already do (and have done for years) manually. Perhaps creating a "table" mode that deals with all table-related parameters like header (and column/row types). resultsfooter could have an option to be the last row or column of the table and include parameters for totals of a specific header (# articles in table, etc), a number field (like a "sum" function), etc. cellseparators could be used instead of listseparators (or at least as an alias) and. of course, support for specifying normal/regular non-suffixed template fields. Essentially, DPL needs more table-specific support to move it beyond just lists, per se. -Eep² 08:28, 29 July 2007 (CEST)
Still need this too... -Eep² 05:40, 11 September 2007 (CEST)

Template field output

Is it possible to output the unescaped wikimarkup (so it actually works as on pages that use the template) in DPL output? I want to create a DPL table that has same links as articles do that use the template in them which is also called in the DPL table. -Eep² 06:56, 26 July 2007 (CEST)


User-friendlines

DPL talk:Manual - DPL Special Page with Parameters#User-friendliness -Eep² 11:42, 25 July 2007 (CEST)


Be PostgreSQL compliant

Request

As of DPL 1.1.7, usage of DPL in a PostgreSQL-based MediaWiki requires further effort, which I describe in DPL:Manual - DPL with PostgreSQL.

  • I don't know if there is a common syntax between MySQL and PostgreSQL for the database functions - if not, my solution is easy to install.
  • But the need for a patch is really nasty. I think with my patch, DPL still works with MySQL as well. If so, could you kindly incorporate it.

I'd be curious if you consider this a feature request or a bug report…


rss feed from dpl

Request

A DPL might also have an according RSS feed. For example, a calendar might give a feed with the upcoming events from now on. --Eiland 09:30, 16 April 2007 (CEST).

Response

I haven´t worked with RSS generation so far. Is there a php library or a mediwiki module for that purpose? --Gero 22:08, 23 April 2007 (CEST)

Plenty of MediaWiki Extensions for RSS... should be easy to integrate with DPL :) --141.14.26.126 13:16, 29 April 2007 (CEST)
Which one would you suggest? Can you do the integration? Gero 20:12, 2 May 2007 (CEST)

Request

I have a similar request... Make each DPL into an RSS feed! --Dmb 11:20, 1 June 2007 (CEST)

Wait... that was me talking ... I just recognized my IP... (oh my memory!)

Well... you could start by looking here...

  1. http://meta.wikimedia.org/wiki/User:Mafs/RSS
  2. http://meta.wikimedia.org/wiki/RSS_into_Wiki
  3. http://www.mediawiki.org/wiki/GISWiki/RSS

That should certainly help with the details. Unfortunately I cannot do the integration myself or I would happily do it immediately. Thanks for the brilliant product and keep up the good work! --Dmb 11:24, 1 June 2007 (CEST)

nudge

Rss rss rss rss rss rss!!!


display Table of Contents for an article

Request

the incudepage feature could be enhanced to include the TOC only; a %TOC% variable would ebe useful ...

Putting delimiters between results

Will this solve a related formatting problem - putting delimiters only between results? Ideally I'd like to have a single result returned inline, but multiple results in an ordered list. It could be I misunderstood the documentation, but there doesn't seem to be a way to avoid a leading bullet or whatever in a list. Frank 14:35, 20 August 2007 (EDT)
There is a mode called 'inline' which does what you want. You can define the 'inline' tag contents. Gero 07:50, 10 September 2007 (CEST)
Nig1  my separator  Nig2  my separator  Nig3  my separator  Nig4  my separator  Category:CountryA  my separator  Category:CountryB

Hook based data exchange between extensions

Would it be possible to add a 'hook' (i.e. wfRunHooks) to DPL? Once a 'query' is finished executing, the result could be signaled to other interested extensions. A 'context id' would be required as potentially many queries could co-exist on the same page. I would suggest adding a parameter such as 'context=' OR just a linear incremental counter.

A 'no output' option would be great also - this way, if the query is really meant to be consumed by another extension, the user isn't distracted by the result from DPL directly. mw:user:jldupont

Reply

I do not have experience with creating hooks. There is a point in the code where the sql result set is ready. But be warned: The columns contained in the result set may vary depending on the options used. Generally speaking, DPL is a beast that has reached its saturation level of complexity ;-). I would more be in favour of a way where DPL produces some kind of csv output which is then fed into another extension. With mode=userformat this is fairly easy because you have complete control over the output. You can create csv or whatever format suits your own extension. This need not be wikitext nor need it be html or plain text - any kind of grammar is possible. For example you can use the result of one DPL statement as a parameter for another one, i.e. you can nest DPL calls. There is a good example for this: Wgraph:Example 4. Here the inner DPL query produces a pipe-separated list for the outer one.

So, the 'no output' you are looking for is already there. It´s called mode=userformat -- and it will take you some time to understand its power. Being the author I am still myself learning what you can do with DPL ;-)

The problem of multiple contexts is also solved by extension nesting. Maybe you do a little exeprimenting and then come up with another comment?

Gero 21:05, 24 July 2007 (CEST)

DPL API

I'd like to see more of an API structure to the code. The manual lists all the parameters and groups them by functionality, but no such break-up exists in the code (at least not that I could tell). At minimum, I'd like there be one function that processes the search criteria to get the results or groups of results in the form of an array of Title objects (or an array of arrays of title objects), and another function to display the results in a specified or default format.

I'd like to be able to build my own extension that uses the DPL2 extension as an API without having to hack the DPL2 code. —Sledged (talk) 01:03, 10 September 2007 (CEST)

Reply

Why don´t you just go ahead with DPL as it is? You can put any call of a parser function into the output loop of DPL. And you can use DPL in a way that it does not produce any single byte of output on its own. You can easily create title objects within your code from the first parameter which is passed to my working template. You might say that this is less efficient than an integration on php level but before trying to optimize you could build your extension right now without any change to DPL and without any code interference. What kind of application do you have in mind, by the way?. For example:

{{#dpl:
  |resultsheader=²{my envelope template¦%PAGES%}²
  |category=some category
  |namespace=some namespace
  |... etc
  |format=,²{my working template¦%PAGE%¦%TITLE%}²
}}

--Gero 07:28, 10 September 2007 (CEST)

I've been toying around with DPL a bit with some of the examples on this site, and I see now that it can do what I want it to do. Excellent! I'm trying to be able to take user-supplied information from a page. In fact, the table on the main page with the headers "Country", "Area", "Population", "Text", and "#hits" is a perfect example of what I want to do. (The answer was in front of me all along.)
I still would definitely like to see an API layout to the code, even more so now. There are some really nice nuggets of functionality that would be useful as a suite of API tools and/or could be made into extensions in their own right, and if the code were in such a format, it'd be easier to pull out those bits of interest.
In fact, I'd like to see the mechanic in the aforementioned example in a form I can use outside of DPL. Also, I'd like to get my hands on that bit of code that utilizes the character escapes to prevent templates, magic words, tags, and other parser functions from being parsed before they're ready to be. —Sledged (talk) 00:25, 15 September 2007 (CEST)
I understand. In fact I had to solve a couple of hairy problems to offer the full power which DPL has right now. I suggest the following: You create one or more modular pieces by lending code from the current source. Thus we have one or more independently usable extensions/modules. Once they are tested and their interfaces have stabilized I will refactor the current DPL code to make use of the new module(s). Although this will create dependencies BETWEEN extensions I think it is the right way to go for. Before you start extracting pieces of the code you should wait for version 1.4.2 as it will have some interesting new features regarding table handling. Internally it tries to solve some really hard problems regarding interaction with the mediawiki parser and its book-keeping on references. Gero 09:12, 22 September 2007 (CEST)
Here's my first installment: Character Escapes. I'm appalled at how simple that solution is and that no one has applied it to ParserFunctions. It doesn't use the escapes you've defined here, because it doesn't work well with heavy nesting. So instead of trying to find a workaround with what you've defined, I used the convention commonly used in programming languages (i.e. the backslash). —Sledged (talk) 06:50, 25 September 2007 (CEST)

redirects include pages that link to redirects

See DPL:Discussion#Redirects to include pages that link to them? -Eep² 05:07, 13 August 2007 (CEST)

My final statement regarding this topic is in the [[DPL:FAQ|FAQ}}. Gero 10:31, 23 September 2007 (CEST)
Can't you just add a simple parameter to redirects (like "strict") that does this automatically without requiring complicated nested queries? -Eep² 10:39, 23 September 2007 (CEST)

linksto and other parameter case-insensitivity option

I need this without having to manually specify lower-/upper-case versions of every page... -Eep² 13:29, 2 September 2007 (CEST)

Mediawiki is case-sensitive by nature. So I can´t see what this should be good for ... Abc is the same as abc but is different from aBc and abC. DPL works on internal page_id numbers and these only exist for existing articles. Gero 14:31, 2 September 2007 (CEST)
Why must you fight me at every point in getting new features in DPL to make it easier to use, Gero? Geez. "Abc" is not the same as "abc" if $wgCapitalLinks = false; is set in localsettings.php, as I have it set in my wiki. I use DPL to list redirects but it requires a lot of variations on the page and support for multiple manually-entered parameters:
	 
|linksto={{FULLPAGENAME}}{{!}}{{FULLPAGENAME}}s{{!}}{{FULLPAGENAME}}es{{!}}{{FULLPAGENAME}}ies{{!}}{{FULLPAGENAME}}ing{{!}}{{FULLPAGENAME}}ed{{#if:{{{2}}}|{{!}}{{{2}}}{{!}}{{{2}}}s|}}	
This query doesn't have any problem if any of these pagename variations don't exist so why would linksto have a problem with pagename case variations either??
Is this like how you couldn't see what "on"/"off" and "1"/"0" for boolean operators is good for? Or why someone would want to create table columns vs. rows (as I want for each game in my comparison table)? It's like the redirect issue you have been resisting and how MediaWiki devs resist adding suffix index (Special:Prefixindex in reverse) despite DPL being able to do it easily enough using a simple wildcard titlematch query (see http://www.tnlc.com/wiki/index.php?title=fire for an example). Enhancements like these make MediaWiki (and DPL) easier (and less frustrating) to use... -Eep² 15:38, 2 September 2007 (CEST)
I really need this functionality, since trying to create case variations for all of the above redirect variations (PLUS creating the actual redirects!) is a tad big annoying... -Eep² 05:40, 11 September 2007 (CEST)
Hello? -Eep² 12:40, 22 September 2007 (CEST)
Version 1.4.2 will have an 'ignorecase' switch. It will have an effect upon 'linksto', 'titlematch', and 'uses', but due to technical reasons not upon 'linksfrom' or any other DPL parameter. Gero 10:34, 23 September 2007 (CEST)
OK, thanks--better than nothing. ;) -Eep² 10:39, 23 September 2007 (CEST)

DPL doesn't respect $wgNonincludableNamespaces

I'm using the Lockdown extension to restrict read access to a certain namespace to one group of users only. Part of restricting read access is preventing page inclusion by namespace. DPL allows one to bypass this.

As a suggestion, if you're able to fix this, could you make it so that with DPL it'd be possible to include / transclude pages within a nonincludable namespace, but not across namespaces? E.g. if I set NS_PROJECT to be non-includable, it'd still be possible to include NS_PROJECT content on NS_PROJECT pages, but not on main namespace etc. pages.

Thanks. 212.149.229.126 15:48, 11 September 2007 (CEST)

Do you think that DPL is wide-spread enough so that it is worth the effort? Is Mediawiki as a whole going to offer consistent support for such protection mechanisms and more elaborated access rights? --Gero 22:07, 11 September 2007 (CEST)
I have no idea how much effort would it take :) DPL's been actively developed for some time, so I thought I'd ask. I do realize Mediawiki isn't supposed to be a proper CMS with proper read access rules and so forth, so the private information wouldn't be that sensitive. In any case, it seems a bit too easy if it's accessible simply by using DPL. At the moment, there's no reason why I absolutely must use DPL, nor is there a reason why I absolutely must have read protected wiki pages. If the feature's very difficult to add, I'll just figure out which of the two, using DPL or having read restricticted wiki pages, save me more time. Thanks. 212.149.229.126 22:58, 11 September 2007 (CEST)


Integrating templates

Hi Gero! By this time, if we want to collect data in many articles using a template, like Example 1, we have to use the descriptions like followed:

includepage={Country} dpl,#History,#Religion[20],revolution

Could it be possible we could use them like followed:

includepage={Country} __,name,capital,dial__,#History,#Religion[20],revolution

or

includepage={Country} {{{,name,capital,dial}}},#History,#Religion[20],revolution

Then we would use Catlist to collect data. Because I am trying to develop the GUI of Catlist. Please see template:Catlist/test. I've added some elements like offset, include, table class and Title of column in it. But I still want to integreat all the templates in the one. The change which I ask for is come from new command table.

By the way, I am afraid that template:Catlist/test use Get instead of Post. Could it be possible it would be disabled by passing too many data? Thank you! --Roc michael 04:32, 16 September 2007 (CEST)

Gero, sorry! I'v seen the Eep²'s case like followed:
|includepage={game}:year,{game}:genre,{game}:publisher,{game}:developer,{game}:engine,{game}:character
It also seems to be great!

--Roc michael 13:39, 16 September 2007 (CEST)

Not really. As I've mentioned to Gero before (though I can't find where it's documented), it would be better if it could be declared like |includepage={game}:year,genre,publisher,developer,engine,character (or perhaps with colons vs. commas) without having to duplicate {game} for every parameter. -Eep² 15:10, 16 September 2007 (CEST)
I have a tendency towards the following syntax:
|include={myTemplate}:parm1:parm2:parm3
it could behave like the parameter list in the 'table' statement. It would deliver each parameter as acolumn of a row. What do you think? Gero 17:30, 16 September 2007 (CEST)
Sounds good. Would there be a way to optionally deliver each parameter as a row of a column too? I still want to have the option of column entries vs. row entries for my game comparison table (so it doesn't become unnecessarily wide due to the amount of parameters--I'd rather have longer vertical scrolling)... -Eep² 07:32, 17 September 2007 (CEST)

You have %USER% and adduser=true, what about %AUTHOR% to go with addauthor and %EDITOR% to go with addlasteditor ?

I realize that if addauthor = true, then %USER% is set to the author, but I want to create a table of data per page that includes both the most recent editor and the page author (first editor). For this we need the %AUTHOR% 'magic workd'.

Man ... so many things about DPL are confusing! I think the adduser option (first/last editor depending on ordermehtod) should be clarified wrt. addauthor and addlasteditor. The description of adduser actually talks about dates!

-D --Dmb 01:49, 17 September 2007 (CEST)

Specific enhancements for 'table from template' DPL

I think a very commonly needed and natural use of the DPL is the 'table from template' DPL. I would like to suggest the following syntax to make it easier to generate such DPL output...

...
incude = {Some template}:parameterOne
incude = {Some template}:parameterTwo
incude = {Some template}:parameterThree
tablehead =  Title,            One,            Two,            Three
tablebody = %TITLE%, %parameterOne%, %parameterTwo%, %parameterThree%
...

The above would generate a table of data for the named parameters passed to 'Template:Some template' in the included pages. I really really love the functions provided by DPL, I just find them hard to master! --Dmb 18:53, 18 September 2007 (CEST)

Reply

That´s almost exactly what will be in the next version! But The syntax will look like this:

...
include = {Some template}:parameterOne:parameterTwo:parameterThree
table   = ,, One, Two, Three

Creating pseudo variables for each column would add new complexity which I try to avoid.

Gero 20:13, 18 September 2007 (CEST)
I understand why keeping complexity to a minimum is important, but the above solution (clean though it is) is very rigid compared to the flexibility afforded by the use of pseudo variables. Imagine the following, parameterOne is information about the category of the page that I would like to wrap [[:Category:%p1%]], parameterTwo is an logo pointer that I would like to wrap [[Image:%p2%|200px]] and parameterThree is a website link that I would like to wrap [%p3% homepage]. None of this funn stuff is available via the above syntax (unless I am wrong). I can think of tons of examples where you just want the parameter, just like %TITLE% (or even %AUTHOR% or %EDITOR%). I am really enjoying watching DPL develope, and I realise that it is very easy for me to make suggestions without any clue regarding the underlying complexity, so sorry for sounding critical. The above is just an idea about what could be nice. All the best. --Dmb 01:34, 19 September 2007 (CEST)
No comment? --Dmb 21:04, 19 September 2007 (CEST)
I´m afraid of the work ;-). The idea is very good, no doubt. Could you help with implementation? Gero 12:52, 20 September 2007 (CEST)
Sorry to hassle you about it, but I was keen to hear your opinion. I can certainly have a look at the source and let you know what I think. I am glad you like the idea :-D --Dmb 21:10, 20 September 2007 (CEST)
That was a real challenge but I think I can come up with a good solution. The next version will contain the following new feature:
 include  = {template}:parm1:parm2:parm3,#some headline
 table    = (tableclass),(articlelink),colheader1,colheader2,colheader3,chapter title
 tablerow = [[%%|''%%'']],[[Image:%%|200px]],[%% homepage],'''%%'''
You will have access to transcluded contents via "%%". This will also be possible for transcluded paragraphs.
Gero 08:13, 22 September 2007 (CEST)

Could I use DPL to collect all the parameters of a template in a list

HI! Gero.I want to use DPL to collect the parameters defined in a template ,by using a argument of DPL that would be called "temppar" or some what, with the result like followed:

*param 1
*param 2
*param 3
*param 4
*param...

{{#input: type = select

name = cars
  • param 1
  • param 2
  • param 3
  • param 4
  • param 5

}}

Them I would use the result to make a multi-select in the Template:Catlist/test 'like followed' in the future. Do you think it is possible?--Roc michael 13:46, 19 September 2007 (CEST)

Reply

I assume that you have many articles which use the same template (t1)? And you want to collect all values for one parameter (xx) of t1 which are used in the template invocations? You can do that with uses=Template:t1 and include={t1}:xx. If it is not a named parameter you can use a number like this include={t1}:2. The format=,,\n, can be used to output only the values of 'xx' in the calls for 't1', not the article names. The problem is that your list will not be unique; it will contain the same entries as often as they occur in the template calls. Maybe you can find another extension which produces a unique list from a list with multiple identical entries. Probably you also want the paramneter values sorted by their value and not by the occurence in the template calls ...

Gero 18:50, 19 September 2007 (CEST)
Gero, Yes, I want to use the parameters of DPL like uses=Template:t1 and include={t1}:xx. But what I really want to do is to make a GUI to produce the code above. when users ,who don't know DPL Skill or who want to use DPL function in convenient way, can dependent on it to query the results what they want directly or produce the different kind of DPL-query-strings. Maybe what I want is like followed not the above.
*param name1 of t1
*param name2 of t1
*param name3 of t1
*param...

{{#input: type = select

name = cars
  • param name1 of t1
  • param name2 of t1
  • param name3 of t1
  • param...

}}

You are right. On the other hand, I really forget the existence of parameters like {{{1}}},{{{2}}}}, because I don't use them in a template for definition items very often. And they will be a hole of the selection items in my GUI. But since it is popular to definition items with named parameter in a template, I think it's worth to create a function to collect all the parameter names of a template. How do you think?
--Roc michael 01:44, 20 September 2007 (CEST)

I am still not sure whether I understand what you want:

  • Do you want to write a DPL query which extracts documentation (like parameter names) from templates?
  • Or do you want to analyse actual invocations of templates and find the values used for parameters?

In the first case your template could use a NOINCLUDE section where it calls another template (maybe named 'tpldoc') to describe its parameters. That would be really nice but would require some effort from the authors of templates. 'tpldoc' together with the dpl query could work a little like javadoc..
Analysing the source code of a template just to find which parameters it uses would only give you parameter names, not their semantics. And the names could even be dynamically constructed like {{{{{{name}}}}}}. Gero 13:04, 20 September 2007 (CEST)

Most popular page

Select by number of views during last n days.

This could be either used to generate most popular pages or in conjunction with other conditions to draw attention to not so often wisited pages from certain category etc.

a) Please sign your contributions.
b) Is there a way to find out when a page has been visited via a SQL statement in wiki database?
Gero 10:37, 23 September 2007 (CEST)

regex for category

Is it possible to use regular expressions for categories? A lot of my categories have highly structured names. Tobias Conradi 21:08, 27 September 2007 (CEST)

See categoryregexp.
Gero 14:25, 3 October 2007 (CEST)

headings

I am trying to use DPL as a more flexible version of Labeled Section Transclusion. As such my request may not be of broad interest but here it is.

I found no easy way to include the heading as part of the chapter include (i.e. the include=#... feature). The only way that worked for me was to wrap the section with <section begin="foo"/> and <section end="foo"/>. But then, the edit doesn't take the user to the correct place. I'd like the edit to take the user to edit the actual text seen--not the page where the transclusion code shows. --Matthew 07:20, 9 October 2007 (CEST)

If you know the heading you can put it into the output stream yourself (using the format statement). If you include the chapter by its position the built-in variable %SECTION% will contain the section title. There is an example for this.
Gero 20:56, 9 October 2007 (CEST)

No More Globals

Since MediaWiki is slowly moving away from globals (see Manual:Global variables), I recommend that DPL also migrate from both global variables and functions. Static class members and methods are a reasonable alternative. —Sledged (talk) 06:18, 10 October 2007 (CEST)


You are absolutely right. The code is not very well structured. It grew from an old simple implementation to a rather big piece of code. Although I think it is still maintainable I would prefer some restructuring. Quality of open source products comes from several authors contributing to the same source (ideally ..). Would you want to start the restructuring effort? You could download the current sources, make the appropriate changes and then upload again within a time frame of, say four weeks... Gero 08:39, 10 October 2007 (CEST)