Sandbox

From FollowTheScore
Revision as of 14:03, 27 September 2009 by J.nesta (talk | contribs)
Jump to: navigation, search

feel free to play around

Playground

You must create valid syntax for the gallery extension if you want to use it within DPL; add debug=5 at the beginning of your statement and check what the Template Template:Infobox Country or territory dpl produces. Gero 10:34, 4 April 2008 (CEST)

1

{{#arraydefine:x|

follow the link in the headline .. ° In the standard configuration DPL registers the <DynamicPageList> tag. This is needed to be downward compatible with extension 'Intersection'.

In the transition phase you may want to install DPL in PARALLEL to 'Intersection' for testing. DPL offers a second entry point for that purpose. Instead of require_once("DynamicPageList.php") you have to use require_once("DPLMigration.php"). DPL will then ONLY register a tag called <Intersection>

In this constellation you can change some of your existing calls of 'Intersection' (which use the <DynamicPageList> tag) to the <Intersection> tag. Once you are convinced that this produces identical results and works with equal efficiency you can change to require_once("DynamicPageList.php"). Don't forget to change the statements back to the <DynamicPageList> tag!. Of course you must also remove the require_once() for the Intersection extension. °

loop detection
The output of a query will never contain the page which contains the query.
This prevents loops, but in some very rare cases it might not be what you expect.
This is a documented feature; use skipthispage = no to include the page which contains the query. Gero 12:43, 4 December 2009 (UTC)
TOC generation
When using mode=category DPL will switch off TOC generation.
Place a manual TOC pragma in your article if you want to get a table of contents
SECTION editing
When using mode=category DPL will switch off section editing generation.
Place a manual EDITSECTION pragma in your article if you want to get a table of contents

°

updaterules define a set of rules which are executed to perform an update on selected articles (bulk update or template value editing)

Syntax:

updaterules=
    rule;
    ...
    rule;

Where rule is one of the following:

  • rules for batch update of articles
   replace   pattern;
      by        replacement;
   before    pattern;
      insert    text;
   after     pattern;
      insert    text;
  • rules for interactive update of articles
   template  template name;
   legend    legend article name;
   table     table format;
   editform  form parameters;
   action    form action;
   hidden    value;
   submit    submit button;
   commit    commit button;
   parameter parameter name;
      value      value;
      format     display format;
      tooltip    text;
      optional   value;
      afterparm  parameter name;
  • common rules
   summary   edit summary text;
   exec      value;

The first group of rules is intended for batch updates of articles. A DPL query can select a group of articles and perform updates like inserting a piece of text at a certain position or changing text portions based on regular expressions.

The second group of rules is intended for interactive form-based editing of template values.

The third group of rules is common to both other groups and controls the update process.

The updaterules feature is intended for wiki expert users only. It is recommended that articles usind this statement are 'protected':

°°

  {{#dplnum:text}}

° The following example would probably be used directly on an article page, but could also be included as part of a template. Parser extensions define a specific tag (in this case <DPL>) and a corresponding end tag (</DPL>). The text between these tags is handed over to the extension module just as it is.

Example syntax
<DPL>
  category = cat1|cat2
  # only pages which contain a link to myPage
  linksto  = myPage
</DPL>
Parsing procedure

Wiki markup expansion does not take place before the commands are handed over to the extension module.

  • This may be useful if you want to pass wiki syntax elements to DPL2 as arguments (see the format option, for example).
  • Magic words like {{PAGENAME}} or {{CURRENTDAY}} cannot be used.
  • Template calls like {{{some template}}}, cannot be used as parameters.
  • Parser function calls like {{#if:...|...|...}} cannot be used within arguments.
  • To pass wiki syntax elements to DPL as parameters it is sometimes necessary to enforce a line break. The reason is that wiki syntax depends on line breaks. Instead, use \n or for that purpose.
Syntax features
  • Every parameter assignment (=command) has to be on a separate line.
  • Lines starting with a # will be ignored (comment).
  • Generally the syntax looks fairly simple and intuitive as it doesn't contain special characters (except for the two embracing tags).
  • Tag case doesn't matter, so it can also be written <dpl>.
  • In many cases there is no need to have macro expansion within the parameter list. Note that in the example above, the pipe character (which is used to define a logical OR between the two categories) can be written as it is. The name of the page (myPage), however, must be a hardcoded constant.

°

ordermethod Determines what criterium (resp. criteria) is (resp. are) used to order the list.

Syntax:

ordermethod=method1,method2,... means ordered by method1 first, then by method2, etc. (like the ORDER BY clause in SQL)

methodN can be one of the following single tokens:

categoryadd
outputs list based on most recent addition to the first category (requires to include one category and one only using 'category' parameter)
counter
outputs list based on the number of times the page has been viewed (by ~popularity)
size
outputs list based on the size of the article (bytes of wiki text)
firstedit
outputs list based on first edit to the pages (creation)
lastedit
outputs list based on most recent edit to the pages
pagetouched
outputs list based on 'page_touched' timestamp. Read comment on page_touched field in Page_table to see the difference from most recent edit by an author.
pagesel
outputs list based on the names of the reference pages which are used in the selection of a linksfrom or linksto statement. pagesel only makes sense if there is more than one page mentioned in the linksfrom or linksto condition.
title
outputs list sorted by article (prefix +) title
titlewithoutnamespace
outputs list sorted by the article name regardless of namespace — (default)

methodN can also be one of the following token combinations (see also headingmode option):

category,firstedit
outputs list sorted by category, then by first edit
category,lastedit
outputs list sorted by category, then by last edit within a category
category,pagetouched
outputs list sorted by category, then by pagetouched
category,sortkey
sortkey
outputs list sorted by title and sortkey, requires at least one category statement
user,firstedit
outputs list sorted by user, then by firstedit by the user
user,lastedit
outputs list sorted by user, then by lastedit by the user
none
do not apply any ordering (except ordering by timestamp if you requested a list of revisions); this method must be used when you specify openreferences=yes.

Note: For downward compatibility reasons DPL will use 'addfirstcategory' as its default order method if called via the <dynamicPageList>

Example:

<DPL>
  category=Africa
  ordermethod=lastedit
</DPL>

This list will output pages that have [[Category:Africa]] showing most recently edited articles at the top. °°

 {{#dplchapter: text | heading | limit | page | linktext }}

°|°}} {{#arraysort:x|random}} {{#arrayindex:x|0}}

3

2

Country Official Name Capital Dial Code
DPL Example 007 main page 1 (%COUNT%) Template:Country dpl.default
Nigunda (%COUNT%) Republic of Nigunda Bamitogoo 237
Nigunda Test (%COUNT%) Republic of Nigunda Test Bamitogoo Test 237
Somango (%COUNT%) Somango Island Aaaabququque 224

Number of data = 1

No Name Languages Government Area Population GDP Independence Day
1 Republic of Cameroon French,English Republic 183,568 sq mi 17,795,000 $43.196 billion 01/10/1961

%TOTALPAGES%

{{#dpl: category=African_Union_member_states¦Cities|resultsheader=%PAGES%|noresultsheader=none|mode=userformat

9

{{#dpl: category=African_Union_member_states¦Cities|resultsheader=%TOTALPAGES%|noresultsheader=none|mode=userformat

9

1 3.2.1

 good morning! 

{{PAGENAME}} DPL Invoking Example

LOL!!!
the {{PAGENAME}} is Sandbox