Difference between revisions of "DPL:Discussion"

From FollowTheScore
Jump to: navigation, search
(Listing redirects and where they link to)
(Listing redirects and where they link to)
Line 459: Line 459:
 
See [[DPL:FAQ]] and [[C]] / [[CC]]. I know that C annd CC are strange names. And they demonstarte how to solve the inverse problem (linksto with redirects). Maybe you want to invest a little time and create an example which is more easily understood?
 
See [[DPL:FAQ]] and [[C]] / [[CC]]. I know that C annd CC are strange names. And they demonstarte how to solve the inverse problem (linksto with redirects). Maybe you want to invest a little time and create an example which is more easily understood?
 
:[[User:Gero|Gero]] 23:54, 22 October 2007 (CEST)
 
:[[User:Gero|Gero]] 23:54, 22 October 2007 (CEST)
 +
 +
 +
==== Examples ====
 +
 +
Okay, maybe this shows a little bitter what I was looking today:
 +
 +
http://semeb.com/dpldemo/index.php?title=Listing_Redirects_and_Location
 +
 +
I imagine one way to do it is by setting these redirects up to use a template. Being able to grab the #REDIRECT value on a page would be handy, though. There may be a way already that I'm overlooking. :)
 +
 +
[[User:Babylon2x|Babylon2x]] 01:57, 23 October 2007 (CEST)

Revision as of 01:57, 23 October 2007

Note: There is a special document for DPL:Bug Reports.

Existing bug reports in this document have been moved to the DPL:Bug Reports.


Could make it possible to show page names by setting in a .dpl template page

I can show pagetitle by adding"%TITLE%" in listseparators but I still want to show the pagenames by adding {{PAGENAME}} or "%TITLE%" in the .dpl template page. Therefore, we can use descriptions such like {{sub:{{PAGENAME}}8|4}} or {{sub:%TITLE%|8|4}} to do something I want. Any ideas Thanks!--Roc michael 17:42, 5 July 2007 (CEST)

PAGETITLE in templates

You can use {{{%TITLE%}}} and {{{%PAGE%}}} within templates. See the manual. Gero 23:51, 5 July 2007 (CEST)

Thinks, Gero! It works very well.--Roc michael 07:47, 7 July 2007 (CEST)

Concept of Subpages

Is there anybody who could explain what subpages are and if they are relevant for DPL ? --Gero 16:01, 15 February 2007 (CET)

Feedback

Thank you for this extension! I was able to create some rather complex queries that receive parameters through templates and that show a list of pages, creation date and author inside some categories. It solved our needs very well. Fernando Correia

Developer level access

Hi there. I was one of the original authors of the DPL (a long time ago, when MediaWiki was simpler and the extension fit on one printed page). I need to make a few changes to make the extension deployable on Wikinews — specifically, the addfirstcategorydate restriction to only work if only one category is included should be removed, and we need to add some simple date formatting to make it possible to show only the date, and not always the date and time (I was thinking of switching the default to show just the date as the older extension does, and make the date/time only appear if something like showdateandtime=true is specified.) I can make the changes, or provide patches; please let me know where the source code repository is (I notice that the mediawiki svn has a much older extension version). You can contact me by email, or at Wikinews -- IlyaHaykinson 11:26, 25 February 2007 (CET)

I would like to support you in rolling out DPL to Wikinews. For the moment I added a generic feature for date formatting. This allows you to configure your date/time format individually, see the DPL:Manual#userdateformat. Sourcecode is here in this wiki but I plan to make it available also in subversion. Could you specify an example for your request regarding "addfirstcategorydate"? See also Test date formatting. -- Gero 15:36, 26 February 2007 (CET)

....

Help with a complex request?

I have the following situation...

  • A) Many 'Template:' pages containing protected text derived from a third party (copyright requires 'verbatim' inclusion of the text).
  • B) Many normal pages that 'transclude' the template pages (based on page name).

i.e. some page = "Template: Subject X" and calling page = "Subject X". Calling page contains a {{{{PAGENAME}}}} construct to call the content from "Template: Subject X".

All the templates of A are in a Category (X) and all the normal pages of B are in a category (Y).

Now... ;-)

I want a DPL to list the 10 smallest normal pages from B ... but when I say 'smallest' I mean the smallest 'overall' pages, including the transcluded text from the companion template in A. This overall size is actually the sum of the size of page A and B. Now I figure I can calculate the overall page sizes using a template and the ... I was going to say {{PAGESIZE}} magic word... but I don't find it!

So basically I am stuck.

Is it possible? --Dmb 11:46, 3 June 2007 (CEST)

Question

What exactly what help you? Is there a table column in the sql database the value of which could serve as an input for your calculation? When DPL lists pages it does not look into their contents. When you ask DPL to do processing based on the contents of a page it will go straight forward for the exact purpose (i.e. look for a headline or a template invocation), but there is no inherent "page inclusion resolution" and no size calculation. Gero 12:53, 3 June 2007 (CEST)

Confusion about includematch

I have a task that I think should be perfect for DPL. On my company wiki, we have a template {{todo|username of who should do it|what should be done}}. I'd like to use DPL to show only the pages that have references to this template AND those tasks are assigned to a particular user. After reading the DPL manual, I thought that I should be able to use

<dpl>
    uses=Template:Todo
    includematch=SomeUserName
</dpl>

However, this seems to list all pages with calls to the template in does not filter based on the username. What's wrong with my method? Thanks in advance. --Gri6507 15:23, 25 July 2007 (CEST)

Try using includepage={Todo} in place of uses=Template:Todo. -Eep² 06:44, 26 July 2007 (CEST)
First, you must use something like 'include={Todo}.dpl'
Note the '.dpl' suffix (any other suffix would do as well). You must create an empty template named 'Template:Todo.dpl'. You could also write some code into that template, but that´s another story.
And then you must indeed use 'includematch'. But (as the manual says) we expect a 'preg' expression here, which means that you must specify something like 'includematch=/SomeUserName/'. If you have named parameters you must use a regexp which matches the parameter´s name as well as the '=' and surrounding spaces and the argument, of course. If you use unnamed parameters you can only hope that the pattern you are searching for does not occur somewhere else. Again, in both cases you MUST use 'preg' syntax, which means that you need delimiters around the regular expression. It is important to understand that the whole wikitext at the position where your template is called will be used for the match test. So you may use something like '/\|\s*username\s*\|/'. You must be very careful to escape the '|' characters as they have a special meaning within regular expressions. I did not test this, so you may need to experiment a little with escapings. If the wiki text author used a newline between the template parameters you need to make sure that your regexp also covers this.
I am really trying top help people here. As some kind of thank you it would be nice if you
  • put your wiki on the "wikis using DPL" list (although it may not be reachable for the public)
  • take your question and my answer and make a contribution in the DPL:FAQ from it.
  • Provide a small example to which the FAQ entry links where we can all study the problem.

o.k.?

Gero 15:32, 26 July 2007 (CEST)
Thanks for the help. I documented my usage in DPL:FAQ#Getting_pages_with_references_to_templates_with_particular_parameters. --Gri6507 13:58, 31 July 2007 (CEST)

Exclusion of Duplicate Pages

Let me start by saying - Cool extension! A fantastic and powerful addition to MediaWiki...

I have just started using DPL, so this question may very well be a result of ignorance. I have articles that are a part of multiple categories. For example, the "HOWTO: Install the Client" page is a part of the 'Client Solution Center' category, as well as the 'Installation' category. I use the following code to render all pages that are a part of the 'Client Solution Center' category, as well as to show what other categories those pages are a part of.


 <DPL>
  category=Client Solution Center
  ordermethod=category,pagetouched
  headingmode=H2
  mode=ordered
 </DPL>

The output is something like:

Client Solution Center
HOWTO: Install the client
Installation
HOWTO: Install the client

I was under the impression that the distinct parameter was implicitly true, and that it should stop the articles from being displayed twice. This does not appear to be the case. Am I doing something wrong, or not understanding this functionality correctly?

Appreciate the help and hard work!

209.139.229.17 16:51, 31 July 2007 (CEST)

Redirects to include pages that link to them?

<dpl>
linksto=DPL:Discussion
redirects=include
</dpl>

Like Special:Whatlinkshere/DPL:Discussion does (test redirect link to this page), I want an option for the redirects parameter to optionally list all pages that link to redirects as well (without having to manually specify all of them in the DPL statement). Is this possible with DPL and, if not, would you please add it? -Eep² 21:20, 31 July 2007 (CEST)

An example of the problems of manually trying to include all variations of a page with redirects via a template:


{{#dpl:
category=Games
|resultsheader=<h2>Games (%PAGES%)</h2>
|noresultsheader=No games have this attribute yet.
|linksto={{PAGENAME}}{{!}}{{PAGENAME}}s{{!}}{{PAGENAME}}es{{!}}{{PAGENAME}}ing{{!}}{{PAGENAME}}d{{!}}{{PAGENAME}}ed
|redirects=include
}}

Say the page is "cut scene" (with redirects from "cutscene" and "cut scenes"). Now, with this setup, if the page that has this DPL syntax on is "cutscene", then pages that link to "cut scenes", "cut scenees", "cut sceneing", "cut scened", and "cut sceneed" will all show up in the list, assuming the pages are in the "Games" category. However, the 2-word "cut scene" won't show up (unless I manually specify it, but this code is for a template). If DPL truly supported redirects as MediaWiki does, I wouldn't have to create all of these linksto variations...and I don't know of a way to programmatically take a root word and break it up into its syllables. -Eep² 12:51, 7 August 2007 (CEST)

I do not know how such a feature could be implemented without having to look into the document contents. If somebody can give a SQL query which does the job I will implement the feature. Gero 14:58, 15 August 2007 (CEST)
Can't you just pull it from SpecialWhatlinkshere.php whch already does it? -Eep² 15:04, 15 August 2007 (CEST)
The code you mention contains a recursive function which triggers a new SQL query for every redirect page. This means a lot of database load ... Gero 18:18, 15 August 2007 (CEST)
Well, DPL is already pretty database-intensive as it is, right, so why does it matter? Besides, this doesn't have to be the default "linksto"/"linksfrom" functionality but optionally. I really need this functionality for my wiki, as manually specifying all redirected pages is highly annoying... Perhaps there's a better way to query the database but I don't know--maybe ask the MediaWiki devs? -Eep² 23:49, 15 August 2007 (CEST)
(Moved from DPL:Requests for new features#redirects include pages that link to redirects)
I think the problem can be solved with nested DPL queries. Create an inner query which finds all the redirect pages (with redirect=only) to your target page(s) and an outer query which finds pages that link to the pages of the result set of the inner query. Apart from that you would have to add another query which finds the direct links to the target pages (using redirect=exclude). In essence this will do the same as the php code which tracks the redirects. C gives an example how to do it. Gero 20:41, 15 August 2007 (CEST)
Too complicated. Why can't "redirects=include" actually work intuitively and actually include redirects like it should? A single query should be able to output results like Special:Whatlinkshere does (without require obscure formatting too). -Eep² 05:34, 16 August 2007 (CEST)
Can't you just create a "redirects=full" parameter, or whatever, that will give all redirect options like Special:Whatlinkshere does? I really need this functionality for my wiki! -Eep² 16:49, 21 August 2007 (CEST)
Well? -Eep² 09:23, 24 August 2007 (CEST)
See User talk:Gero#Hello? for further "discussion". -Eep² 15:57, 2 September 2007 (CEST)

Fancy template filtering: is this possible?

I have some pages where I call the same template a number of times. On these pages I call a template that formats an extract from a web site and includes the name of the site and the URL.

Elsewhere I would like use DPL to list all the place where any given website is called via this template.

This appears on a page somewhere:

{{Web citation|
web link=http://www.google.com|
title=Google Home page|
date=June 29, 2006|
source=Google|
extract=What do you expect!}}

{{Web citation|
web link=http://www.yahoo.com|
title=Yahoo Home page|
date=October 12, 2006|
source=Yahoo|
extract=Another search engine}}

This template formats the passed output such that the parameter "source" is used as an internal wiki link. This would then let me have a page for "Google" and another for "Yahoo".

Elsewhere I'd like to find all the pages that have the source = Google.

I can already list every page that uses this template and this also lists all uses of the template on that page (so for this example I'd see both Google and Yahoo listed). I'd like to only include the uses of the template that link to Google. I'd like to put this on a page called Google so that this would then collect all references to Google across my site.

On a page with the Title "Google"

{{#dpl:categorymatch = % | linksto = {{FULLPAGENAME}} | includepage={Web citation} dpl2 }}

Is that clear? Any help would be much appreciated. DPL is fantastic, even if the learning curve is a little extreme.

Brianoflondon 20:11, 6 August 2007 (CEST)

Try notuses=Template:Yahoo but you'll need to have separate templates for Google and Yahoo in order for DPL to include one (Google) and not the other (Yahoo), in this case. I don't think DPL supports notlinksto for external URLs, but I haven't tried. -Eep² 12:57, 7 August 2007 (CEST)

#DPL reminder

When using DPL with the parser function form, keep in mind that *all* arguments that contained the pipe character “|” should be transformed into a "special" pipe “¦”. Especially the category match parameters, where I tend to forget about this rule of thumb. Using the debug level when testing should be a good idea, too. - 82.249.32.133 16:16, 16 August 2007 (CEST)

all namespaces

How do I get a list of all namespaces? -Eep² 12:46, 29 August 2007 (CEST)

Answer

Unfortunately there is no built-in way for that. You could create a page with identical name in each namespace and call it, say, 'About this namespace'. A DPL query with a titlematch on that name would then deliver exactly all these pages. Using the %NAMESPACE% variable you get the list you want. Not really nice, though ... Gero 13:22, 29 August 2007 (CEST)

Well, don't you think DPL should be able to do that inherently like it can with categories and pages? -Eep² 13:29, 29 August 2007 (CEST)

Show Articles in one Category by Sortkey

I just created these 3 Articles which are categorized in a different order than the title names:

{{#dpl:category=VolkoV}}

How is is possible to sort the Articles in the categorized order?--VolkoV 18:37, 31 August 2007 (CEST)

DPL is extremely powerful. To use its power you will have to spend some time with the manual. I changed the queries on your homepage; now the list is ordered by categories. There are even two variants of how to do it. With mode=userformat there are further possibilities - you could even create tables which can be dynamically sorted by a click of the user. Have fun! Gero 22:39, 31 August 2007 (CEST)

Thanks, I extended the example, Page C is categorized as A as well under VolkoV as under TopVolkoV. In this case, using your Code produces a double Entry in the List. And this ist exactly what happens in the productive System as well. Is there a workaround? We use DPL to produce Lists with the Links to Pages of a category an a small description which is read in the template. This far it works pretty good, only the sorting makes problems.--VolkoV 07:51, 1 September 2007 (CEST)

I figured it out by myself: I needed to use the "+" before the category name. It works now, as I wnated to...--VolkoV 08:39, 1 September 2007 (CEST)

notcategory/notnamespace

Why can't these parameters accept the "OR" separator (|)? -Eep² 13:08, 1 September 2007 (CEST)

Examples using other extensions

Need more of these to show that DPL can be just as good as Semantic MediaWiki--if not better--at listing relationships between articles (like which articles have populations over/between/under certain amounts, etc. I believe this is possible using nested DPL queries that use the math parser functions. -Eep² 05:27, 4 September 2007 (CEST)

Category lists that show content amounts

I want to create standard MediaWiki category lists but with the amounts of articles/subcategories in each member in parentheses:

Articles (2)

A (2)

  • Article (4)
  • Article (3)

B (1)

  • B Article (2)

C (1)

  • C Article (1)

resultsheader does the "Articles (2)" part but how do I get each member (and beginning letter/symbol of that member group) to show how many articles/subcategories are contained within them? If the member is an article, I want to show how many articles link to that article (as I currently do for each article on its page). See http://www.tnlc.com/wiki/index.php?title=Category:Templates for an example of this:

{{#dpl:
namespace=Template
|mode=category
|ordermethod=titlewithoutnamespace
|shownamespace=no
|rowcolformat=width=100%
|redirects=include
|resultsheader=<h2>Templates (%PAGES%)</h2>
|noresultsheader=<h2>Templates (0)</h2>''No templates.''
}}

-Eep² 13:12, 4 September 2007 (CEST)

Reply

This would definitely have to become a hardcoded feature in the php source. Gero 19:28, 4 September 2007 (CEST)

Which PHP source, MediaWiki or DPL? Is there a way to do this "manually" (i.e. without mode=category) in DPL at this time? -Eep² 00:33, 5 September 2007 (CEST)
The DPL source.

Replace delimiter-separated lists with links

Is this possible with DPL? See mw:Extension_talk:StringFunctions#Delimiter-separated_lists_into_links for more info. -Eep² 15:43, 11 September 2007 (CEST)

Not with DPL. But you can try to use the StringFunctions extension. The version here in this wiki is slightly modified and uses preg_replace() and that should be able to do the job. Read the php manual on preg_replace. I can make the modified StringFunctions version part of the download archive if you succeed. --Gero 21:21, 11 September 2007 (CEST)
If I succeed at what? How about getting the preg_replace in the actual mw:StringFunctions extension too? -Eep² 23:06, 11 September 2007 (CEST)
If you want to use a concept like regular expressions you will have to invest some time in reading manuals! StringFunctions extension gives a demonstration of what you can do. I put the source code of StringFunctions there because I got the impression that the maintainers of the official code are somewhat reluctant about adding regexp syntax to the extension... --Gero 08:14, 12 September 2007 (CEST)
I've told you before I'm not a programmer, and can't stand (or sit) doing it. Anyway, I'll try your version; thanks. I need to nest the replace in an {{#if:}} but the default StringFunctions extension doesn't render it if I try something like {{#if:{{{actions|}}}|[[{{#replace:{{{actions}}}{{!}}, {{!}}]], [[}}]]|?}} but it doesn't work (with the {{!}} or just a |). The result is [[{{{actions}}}|, |]], [[}}]] (as-is in plaintext with no parameter replacement or formatting). Do you know why? Using your version I'll have to nest yet another replace so I don't know if that will work inside an if either... -Eep² 09:03, 12 September 2007 (CEST)
OK, I tried using {{#replace:{{#replace:|{{{actions|}}},|/ *([^,]+)/| [[\1]]}}|/,$/|}} but the result is blank with |actions=climb, dive, grab edge, jump, pick up, pull, push, roll, run, shimmy, shoot, sidestep, swim, vault, walk in an article template field. -Eep² 23:12, 12 September 2007 (CEST)
Hello? -Eep² 12:01, 14 September 2007 (CEST)
My dear friend, I am not here to teach somebody programming who says he can´t stand being a programmer and at the same time wants to do things which can only be done with that special attitude of modestness, concentration and thoroughness which is always required if you want a computer make to do what you want it to do.
 {{#if:{{{1|}}}|{{#replace:{{#replace:{{{1|}}},|/ *([^,]+)/| [[\1]]}}|/,$/|}}|}}
Gero 18:07, 16 September 2007 (CEST)
Well, it's not like I'm not trying, Gero. Not everyone's cut out to be a programmer--and I've never claimed to be one. OK, so the only thing I had wrong was the "|" after the second {{#replace:. However, now there's no longer a space after the comma (which I tried adding a " " and even " " to after the commas but the result is still no space--and a trailing comma at the end, which I don't want).
I see you added a DPL:FAQ#I want the article list separated by comma that uses DPL but how do I get this using regular expressions as above? I'm still getting a space before the first word in my game template. -Eep² 16:49, 23 September 2007 (CEST)

More comma problems

Trying to get just a plain list of pages without links to them via:

{{#dpl:namespace=
|linksto={{PAGENAME}}
|redirects=only
|format=,%PAGE%, 
|resultsheader=<ul><i>Redirects: 
|resultsfooter=</i></ul>
|noresultsheader=<div style=display:none>
|noresultsfooter=</div>
}}

...but the commas aren't getting rendered. How do I do it? -Eep² 14:01, 16 September 2007 (CEST)

Answer

I think there is an example for this problem in the FAQ. Use &#44; to produce a comma (see the source of this article!):

format=,%PAGE%, ,
Gero 17:52, 16 September 2007 (CEST)
Tried that but then there's a comma at the end of the last result too, which I don't want. How do I fix that? -Eep² 07:21, 17 September 2007 (CEST)
OK, the FAQ (link in previous section) explains how using mode=inline|inlinetext=,  (non-breaking space code not shown, for some reason) but what if I don't want the results to be links? I'm trying to make redirects list and having the results links is pointless since they redirect back to the same article anyway... -Eep² 16:59, 23 September 2007 (CEST)

Indeed inlinetext only works for standard output, not for 'userformat'. You must add a comma in the format statement and then remove the last comma like this:

...{{#replace:Nig1,Nig2,Nig3,Nig4,Nigunda Test,Nigunda,Nigeria,|/,$/|}}...

or with an additional blank

...{{#replace:Nig1, Nig2, Nig3, Nig4, Nigunda Test, Nigunda, Nigeria, |/,$/|}}...

Gero 17:03, 27 September 2007 (CEST)
I tried this but it still leaves the trailing (end) comma:
{{#replace:{{#dpl:namespace=|linksto={{PAGENAME}}|redirects=only|format=,"%PAGE%", ,|resultsheader=<ul><i>Redirects: |resultsfooter=</i></ul>|noresultsheader=<div style=display:none>|noresultsfooter=</div>}}|/,$/|}}
Eep² 23:51, 27 September 2007 (CEST)

A convoluted problem (DPL Recursion?)

In the manual where it talks about special chars, there's a mention of nesting DPL calls and DPL recursion, but there doesn't seem to be any elaboration or example of what this means/what you can do with it.

I'm working on a project at the moment that I'm not quite sure how to approach. For example:

A dish is made up of one or more recipes that in turn are made up of ingredients.

In this case, I'd be wanting to find all of the dishes that used recipes that contained a specific ingredient so that I could have a list of dishes that contained that ingredient.

How I'm currently getting recipes using a particular ingredient is something like the following:

{{#dpl:
   namespace = Recipe
 | uses = Template:Ingredient_Item
 | include = {Ingredient_Item}:Ingredient
 | includematch = (Potato)
}}

Is there a way to grab any dish pages that refer to those recipes (at this stage, I'm expecting to use a "Recipe_Item" template in the same way that I'd use Template:Ingredient_Item|Potato in a recipe)? Failing that, is there a way that I can put the above DPL call into the linkto parameter of another call?

- Cheese 22:29, 7 May 2024

Reply

I think DPL is powerful enough to solve that kind of problem structure. You need two different articles, one of them contains the 'inner' query, the other on contains the 'outer' query. The result of the innner query is formatted in a way that it can be used as an argument to the 'linksto' parameter of the outer query. I think you can learn from a short example I gave some weeks ago. It has the belletristic name of C resp. CC. It would be awfully nice if you could turn that example to something with dishes, recipes etc. That would really justify a better name like "Example with nested DPL queries" ;-)

If you run into problems I will try to help as the kind of application you have in mind is exactly what I often face and where I want DPL to be helpful.

Gero 17:00, 2 October 2007 (CEST)

Success

Many thanks, Gero

After having a bit of a play around, I've come up with this in my ingredient page ("Potato" would be replaced with PAGENAME):

{{#dpl:
   namespace = Recipe
 | uses=Template:Ingredient_Item
 | include={Ingredient_Item}:Ingredient
 | includematch = (Potato)
 | replaceintitle=/ /,_
 | format = ,²{DPL_Sub_Query¦NamespaceName=Dish¦TemplateName=Recipe_Item¦ParameterName=Recipe¦Value=%TITLE%}²,}}

and this in Template:DPL_Sub_Query:

{{#dpl:
   namespace = {{{NamespaceName}}}
 | uses=Template:{{{TemplateName}}}
 | include={{{{TemplateName}}}}:{{{ParameterName}}}
 | includematch = ({{{Value}}})
}}

Obviously I'll be making more specific templates for the project I'm working on (the above is just to make sure I'm understanding what's happening). Once I've got it ironed out a bit more, I'd be happy to help adapt it as an example.

Also, Eep² has some questions that are hiding away at Talk:C

- Cheese

Matching and Output

In my above dish/recipe/ingredient example, I'm using the include parameter so that I can use regex to match against it. Since I'm only getting the dishes that have potato in them, it's a little redundant to also have "Potato" in the output.

Currently I'm using the format parameter to hide it with HTML comments. Is this the best method for getting what I'm after? Is there a way to match using regex against content without including it?

 | format = ,\n* [[%PAGE%|%TITLE%]] «!--,--»

- Cheese

Using html comments is a nice trick, although not very clean ;-).
Did you have a look at the "table" and "tablerow" commands? If you specify an empty parameter at tablerow the contents will be suppressed. But you probably will get an empty column in the table...
Currently there is a conceptual link between "include" and "includematch". The regexp is applied to the parameter list as a whole. So you can match on parameter1 and include parameter2 of the template. But you must at least include one parameter.
Gero 11:25, 3 October 2007 (CEST)

Listing all articles in category including the current page?

Let me explain best I can. I have a category 'Location' which contains:

  • Location A
  • Location B
  • Location C
  • Location D


Every one of these pages has a navigation template included, to make it easy to navigate around the content. The navigation is generated using <dpl> category=Location </dpl>. This is great, for the most part, but if it is included, ie, from the page Location B, the list will not include that title, thus the navigation listing becomes:

  • Location A
  • Location C
  • Location D


While it may seem strange, for the sake of the list staying the same at all times, I really want it to include every page including 'Location B' even though it would just a title name bolded. Is it possible, or can I change a line of code to stop the current page name being filtered out from the results?

Thanks, Babylon2x 07:28, 9 October 2007 (CEST)

Reply

There are good reasons why DPL blocks the current page from being part of the result set. These reasons have to do with the transclusion of contents and possible indirect recursions in complex queries. There is a well document "if statement" near line 2655 which you could comment out if your query is rather simple in its structure. But I would advise to introduce a new commandline parameter which might be called "skipthispage=no" (default being "yes"). This would allow you to use the parameter only in that very DPL statement.

Gero 21:16, 9 October 2007 (CEST)

... Well, it was an easy change so I added that parameter to the official version here. In return it would be nice if you could test some of the test queries in this wiki with the new parameter set to "no". If the query still works you can leave the parameter there. Let us know here if you run into trouble.

Gero 22:00, 9 October 2007 (CEST)

Thanks!

I'll update and get testing ;)

Listing redirects and where they link to

I would like to list all redirects in a category, but also I'd like to know where each redirect goes to. I know how to use DPL to create the list of redirects, but I am not sure if it's possible to list where each redirect goes.

The end result would ideally be:

Acronym Title is an acronym for Acronym Title Redirect Title

Solution

See DPL:FAQ and C / CC. I know that C annd CC are strange names. And they demonstarte how to solve the inverse problem (linksto with redirects). Maybe you want to invest a little time and create an example which is more easily understood?

Gero 23:54, 22 October 2007 (CEST)


Examples

Okay, maybe this shows a little bitter what I was looking today:

http://semeb.com/dpldemo/index.php?title=Listing_Redirects_and_Location

I imagine one way to do it is by setting these redirects up to use a template. Being able to grab the #REDIRECT value on a page would be handy, though. There may be a way already that I'm overlooking. :)

Babylon2x 01:57, 23 October 2007 (CEST)