User:Andy Maloney/Notebook/Lab Notebook of Andy Maloney/2010/03/31/Fun with dynamic page listings

From OpenWetWare

< User:Andy Maloney | Notebook | Lab Notebook of Andy Maloney | 2010 | 03 | 31
Revision as of 22:15, 8 August 2010 by Andy Maloney (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

I think I have finally gotten something to report for dynamic page listings. It appears that you can setup a template and in the template, write a description for the page. This description can be used as a summary for a dynamic page listing. The code for the dpl is below.

{{#dpl:
 |namespace=User
 |order=descending
 |addcategories=true
 |uses=Template:AndyMaloneyNotebook
 |includepage={AndyMaloneyNotebook}:[[%PAGE%]]
 |includepage={AndyMaloneyNotebook}:Description
 |format=,\n*[[%PAGE%]]\n**'''Categories:''' %CATLIST%\n**'''Description:''' ,,
}}
  • namespace=User
    • This just tells dpl to start looking in the special page Users where all our notebooks belong.
  • order=descending
    • I'm pretty sure that this means that the pages shown will show up in dpl in a descending order. I think that the first page shown is not the most recent edited page but the most recent created page.
  • addcategories=true
    • This just allows me to add a list of categories used on the page. Since I am using a user specified format for the output of dpl, I have to include this command as well as the one below in the format.
  • uses=Template:AndyMaloneyNotebook
    • This tells dpl that the pages it should list, must have the template AndyMaloneyNotebook. Otherwise, it won't include it.
  • includepage=
    • So there are two things that I want to include in the list namely, the page name and a description. I have to break up this into two lines (hence the two includepage commands) in order for dpl to format the output in the way I want.
  • format=
    • So you must start this line after the = sign with one comma. You must end it in 2 commas. dpl will allow wiki markup as you can see with the stars and apostrophes dictating a list and bold type. The \n is required for dpl to start a new line.

Output

You can see that if a page does not have any categories listed in it, dpl returns nothing. You can also refine the listing by adding the category= command as given below. Now the only thing that shows up is the page where I have both my template and the category=Kinesin and microtubules.


Personal tools