Talk:DynamicPageList2

From Meta, a Wikimedia project coordination wiki
This is an archived version of this page, as edited by 203.167.229.2 (talk) at 10:17, 8 August 2006 (→‎Add Format Option for display in sidebar). It may differ significantly from the current version.

Bug Reports

Open bugs

Report new bugs here.

Fixed/Closed bugs

mediawiki 1.6.7

I just installed Hack v0.4 on mediawiki 1.6.7 and it doesn't look like it works. I'm getting an error of "�UNIQ6a4384fe7ede8cae-DPL-2e4ad3a31eb82cc200000002-QINU". Has anyone had any luck installing it on this version? --200.82.238.132 06:41, 2 July 2006 (UTC)[reply]

Fixed in v0.5 (tested on mediawiki 1.6.7). --Dangerville 03:00, 10 July 2006 (UTC)[reply]

I have the same thing coming up on mediawiki 1.6.5, PHP 4.3.10, MySQL 4.1.8-standard. This is the only extension installed. I also get the following PHP error printed 9 times above the wiki logo:

Warning: end(): Passed variable is not an array or object in /var/www/html/mediawiki/includes/Parser.php on line 583

Rob.desbois 08:26, 5 July 2006 (UTC)[reply]

Try v0.5 and let us know. --Dangerville 03:00, 10 July 2006 (UTC)[reply]
Great, that works fine for me now --Rob.desbois 09:26, 10 July 2006 (UTC)[reply]

parsing notcategory parameter

I believe that these lines contain a bug (line 148 of today's version :)

			case 'notcategory':
				$title = Title::newFromText( $parser->transformMsg($sParam, $poptions) );

They should be as follows:

			case 'notcategory':
				$title = Title::newFromText( $parser->transformMsg($sArg, $poptions) );

-- jsimlo 16:23, 1 July 2006 (UTC)[reply]

Yep. Fixed in v0.5.--Dangerville 03:22, 10 July 2006 (UTC)[reply]

parser object

There are two lines I have troubles with, in the section of parsing parameters:

   $parser = new Parser;
   $poptions = new ParserOptions;

Why there is a need to instantiate a new parser and more importantly, the new parser is unable to call the hook and returns with Invalid call hook DPL, when there are two or more DPL2s on the same page. I have commented those lines out and added this one instead:

   $poptions = $parser->mOptions;

The problem is now gone and it all works.. Well, only as long as there is just one DPL on a page. If there is more DPLs on a page, all others return some weird string, something like: UNIQ9bcbc62b0913-DynamicPageList-221d7c792ea74a1a00000002-QINU which seems to be an id of a message. Please help. -- jsimlo 16:48, 1 July 2006 (UTC)[reply]

After some research I have figured out one thing: the code v0.4 probably recreates the global parser, which destroys all the previous parser settings. Look at these two lines:
function DynamicPageList2( $input, $params, &$parser )
   $parser = new Parser;
Wheh I replaced the second line with this
$parser2 = new Parser;
and replaced all occurences of $parser to $parser2 afterwards (there are two of them for parsing category and notcategory parameters), all things started to work. Now I have six DPL2s on the same page and all seems to be fine. Afaik.. ;)) Hope that I have helped.
-- jsimlo 17:02, 1 July 2006 (UTC)[reply]
Indeed. Fixed in v0.5. Using the global parser to parse in the extension is bad. See How do I render wikitext in my extension?. Hope it helps.--Dangerville 03:22, 10 July 2006 (UTC)[reply]


addfirstcategorydate=true

The date is being displayed as:

<> 6, 2006

Using mediawiki 1.5.6 and my preferred date format in preferences is the second option

16:12, January 15, 2001

just below "No Preference."

Fixed in v0.4 (on the svn repository, tested with MediaWiki 1.6.5) --Dangerville 23:45, 25 June 2006 (UTC)[reply]
From another mediawiki user: I am experiencing the same problem. with any date preference or no preference. The day of month comes out as "<>" . very strange, why might this happen? Is there some addtional date prefences that needs to be set up in LocalSettings.php? All I have customized is time zone. --Maxelrod 23:58, 28 April 2006 (UTC)[reply]
In prev version, the line $wgLang->date($row->cl_timestamp) could cause wrong output because the DB field cl_timestamp is in wrong format (MySQL timestamp field) for the date function (unlike page_touched or rev_timestamp which are mysql string fields with a timestamp-like format, different from mysql timestamp). Solution used in v0.4 (tested on mediawiki 1.6.5): the mysql DATE_FORMAT function with argument '%Y%m%d%H%i%s' converts cl_timestamp values to format (same as page_touched) compatible with the date function. --Dangerville 23:45, 25 June 2006 (UTC)[reply]

Feature Requests

I will not have time to work on DPL the next time, so if you have a few days to spare and fix some of the issues below, I would be glad and include your code! Thanks. Unendlich 16:49, 13 May 2006 (UTC)[reply]

Open

Request a feature here.

Include first lines of content

It could be a nice feature, if the DPL could include a few lines of text of each page on the list. This would be very useful for semi-automatically created content lists on main pages and portal pages. Some of our content consists of long articles, blog entries and newsposts. In all cases, the titles doesn't precisely give away the content - so it would be nice with some extra information on a dynamic list.

It could be done in several ways :

  • A la search results pages (created semi-automatically)
  • Could be limited to a user-specified number of characters to be included, for each page on the list.
  • Content could be rendered (preferably), or shown wiki-text (as search result pages).
  • Alternatively, a manually entered and tagged subtitle (on the respective pages) could be included (something like <subtitle>This article deals with...</subtitle>).

Otherwise, great work! --MortenB 17:08, 18 July 2006 (UTC)[reply]

The Newest Pages Blog extension offers the kind of summary feature you are looking for, using a newestpagesblog-summaryendmarker (cf. readme). Have you found a similar feature in another extension or elsewhere (with the source)? If not, I (or others welcome) intend to integrate/adapt their solution (in)to DPL2. Sounds reasonable. --Dangerville 06:51, 24 July 2006 (UTC)[reply]
Thanks for the tip :-) - Sounds interesting; I will check it out right away. I have been through most of the extensions listed on this site and haven't found anything else yet which comes close. I'll get back to you here, if I find other extensions, which might be useful to look at.
However, the DPL could perhaps *simply* make use of the template mechanisms and <noinclude></noinclude> tags already in place in MW? What I am thinking, is that if DPL allow an option to be set in the dynamic list to include the complete article in the list, the user could simply specify what parts of pages to include and what not to. This would make brilliantly possible the kind of dynamic lists I look for to make our front page almost completely automatically updated. This would also provide the ultimate freedom to include on lists what you wanted from specific pages. It should be a perfectly optional setting in a DPL, which by default should be off. Of course, possibly the best user-friendly solution would be one not requiring users to enter tags at all on their newsposts (requiring some kind of specified character count only in the DPL, which is used if no tags are set).
I'm not sure if this goes too far beyond the intention of this extension, or it belongs in an extension of its own. Clearly too much "checking content" of listed pages, will slow the extension down somewhat. --MortenB 12:26, 25 July 2006 (UTC)[reply]
I've looked at the Newest Pages Blog extension, and it sure does things along the lines I try to describe above, if only in a slightly less flexible way than the DPL... I'll try it out. However, it sure would be great to include this kind of functionality, if possible, into the DPL, as the functionality seems much more flexible with this approach. --MortenB 16:18, 25 July 2006 (UTC)[reply]
I read too fast the first time. It is much more an excerpt feature than summary, which means that your idea of using special tags for text to be included in the list is more appropriate (much more flexible) than the summary solution of the Newest Pages Blog extension. So relying on a special tag like <noinclude> (or <includeonly>?) sounds good. In any case, as you suggested, this should be combined with a user-specified DPL2 parameter that sets the max number of characters to be included, in case:
  1. the special tag (e.g. <noinclude>) is not used in the page at all;
  2. special tag is used but too too much text (really) included with that.
Last, if special tag is used more than once in same page, DPL2 would include text from the first chunk only. --Dangerville 07:12, 26 July 2006 (UTC)[reply]
Sounds brilliant :-) - With this functionality it could be used for either - a list of pages with a short summary/subtitle, or inclusion on the list of an excerpt or the near complete page. One additional thing which might be important is to add an additional "mode" parameter to format the pagename/title/link to the complete page, as either a "headline" link, or as a link ("read more.../customizable text") appended at the end of the included text, or maybe both. Yes I know I am asking for a lot, but better take all things into account.
In all cases, keep up the good work - this extension is already greatly expanding the use of categories and namespaces in MW, to make it even more flexible and powerful. --MortenB 23:51, 28 July 2006 (UTC)[reply]

Group by user

This extension is almost what is being requested at en:Wikipedia:Administrators' noticeboard#image deletion, except that it also needs to be able to group by the user who created the article. You could have a parameter groupby=creator|lasteditor|categoryadder. Instead of grouping, it would probably be enough to add these as additional values for ordermethod, perhaps allowing a sub-order as well. Bovlb 07:20, 20 September 2005 (UTC)[reply]

As of now, I'm afraid MediaWiki does not allow any reliable way to get the user that creates a specific category link in a page, if there is any. I guess some changes in the core of MediaWiki would be necessary, so something like 'groupby=categoryadder' - as you suggest - goes beyond the scope of this extension. More info on http://mail.wikipedia.org/pipermail/wikitech-l/2006-July/037120.html. --Dangerville 07:11, 24 July 2006 (UTC)[reply]

Select Subcategories to be listed

example: <DPL> category=Hauptkategorie list=subcategories {"subcategories"|"pages"|"both"} </DPL>

inline format, items italic or bold

I prefer ( cat1 • cat2 • ...) and if not already the case, the ability to have the items in bold or italic. (Kevin Baas) 69.211.213.120 21:02, 10 October 2005 (UTC)[reply]

Your example ( cat1 • cat2 • ...) is confusing. Do you mean ( page1 • page2 • ...)? In this case, it is available since v0.3.3 with 'ordermethod=inline'.

Limit number of characters

Doubt this will make it, but on my wiki I have a few pages with long titles. On my Main_Page I have a list off to the side that displays the last edited in certain categories. Well, I would really like to have it show the first X number of characters then just add some ... after it or something.

Supress 'minor' edits...

There should be an option (prolly the default) to ignore page updates which are minor. I.e. they should not get pushed up onto the top of recently edited pages in the DPL. Setting something like 'minoredit=TRUE' would restore the current behaviour.

Also a special 'category=nocat' category would be nice, i.e. all new pages or edits for pages which have not been assigned to any category. That would be useful for site administrators and pedants everywhere :) --193.60.81.207 19:42, 11 November 2005 (UTC)[reply]

sortkey from category tags, list subpages

Ordermethod should also include sortkey (from category tags), so that the ordering can be customized. Also, it would be brilliant if this could be extended to also show dynamic lists of subpages. 193.77.78.187 18:08, 27 November 2005 (UTC)[reply]

CategoryOnly

Add a parameter that limits the results to pages in the spefied category (or categories) and no others for example Catonly=stub would show pages in Category:Stub, but not in any other category. 205.210.232.62 20:32, 21 April 2006 (UTC)[reply]

I think that is what the category parameter does. (SEWilco 18:45, 26 June 2006 (UTC))[reply]

Title or something like this

Hello! I would appreciate a bit of help, but I do not think this could be done. I would like to use this function with an "if" template but it does not work. I would like to add a title before the list but only if there are articles in the category. I though that with something like this would work:

{{#if:<DynamicPageList>
namespace=0
category=65655
count=8
</DynamicPageList>|
===Title===
<DynamicPageList>
suppresserrors=true
category=category name
count=10
</DynamicPageList>}}

However, it does not. I have tried with all kind of "if" functions. I have tried {{#if:}}, {{qif}} with {{#ifeq:}}, with {{#switch:}} and with {{switch}}. I have tried writing the "suppresserrors=false" and then saying that it should be equal to "DynamicPageList: No results!". Nothing has worked and therefore the problem is in this code, not in the if functions. Is there any way to fix that? If the answer is no, would it be possible to add a parameter such as "title" that would add a text before the list (in this case, the text would be "===Title===") if there are articles in the category?--SMP (talk page) 08:53, 26 June 2006 (UTC)[reply]

Most popular article

I should be fine if we have the same features has [Dynamic_Article_List, i means the possibility to have an ordermethod by hit count:

ordermethod=hot
addHitCount=true|false

Thx Christophe

All namespaces, All categories

Is it really necessary to have You need to include at least one category or specify a namespace! error message? The number of returned articles is limited anyway. And in small wikis, there may be a good reason to list all recently modified articles, e.g. for an export list:

<DynamicPageList>
ordermethod=lastedit
addeditdate=true
order=descending
</DynamicPageList>

--jsimlo 14:02, 21 July 2006 (UTC)[reply]

The message has been changed to 'You need to include/exclude at least one category or include/exclude at least one namespace!' in v0.5.1. If your example was valid, you would get ALL the pages on your mediawiki (in the order specified), which includes more than 1400 pages created by default with the installation of MediaWiki (most of which are in the MediaWiki namespace I believe). In fact, as of v0.5.1, you can get the same result by using notnamespace with a non-existent (fake) namespace or notcategory with a non-existent category. So I agree that error message is now irrelevant and will be removed. --Dangerville 07:59, 24 July 2006 (UTC)[reply]

Do not set a category

It shoulb be fine to have an option to display all articles from all categories if we have set a namespace. For example if we have set a namespace ant not a category, we display article from all categories from this namespace. Thx Christophe

I believe this already works. You have to specify at least one namespace or at least one category. --jsimlo 14:02, 21 July 2006 (UTC)[reply]
Yes, to clarify, as of v0.5.1, the minimum is to use one of these 4 options:
  1. Include one namespace with namespace parameter
  2. Exclude one namespace with notnamespace parameter
  3. Include one category with category parameter
  4. Exclude one category with notcategory parameter
In your case, it would be the option 1. --Dangerville 05:15, 22 July 2006 (UTC)[reply]

OK, it sorks fine with the last release for the first case, but not for the second. --Ctof 10:17, 25 July 2006 (UTC) Case OK:[reply]

<DPL>
ordermethod=lastedit
namespace=Java
adduser=true
</DPL>

Case KO:

<DPL>
ordermethod=pagetouched 
namespace=Java
adduser=true
</DPL>

another point is useradd, *date* do not display anything after the title article. PS: i use Mediawiki 1.7.1

Add Format Option for display in sidebar

Can someone add a format option so the pages can be displayed in a sidebar? I know it can't be too difficult... in the sidebar, I'm thinking you could just put:

* recently updated
<DPL>
 category=somecategory
 ordermethod=lastedit
 sidebar=true
</DPL>

What would be displayed is something like

* recently updated
** wikilink1|title1
** wikilink2|title2

Also there should probably be a "limit number of characters in title to display" option also. Additionally, if there was an option to define the wrapper tags, might be a little more open ended... might get a little complicated then... thanks for the help, guys!

Agreed. I'm currently hacking together a CSS menu based on DPL2 for a corporate intranet. Links in the sidebar go to categories which act as client indexes. Being able to mouseover a sidebar entry and have a menu popup with a list of pages from that category would be extremely handy - especially when you consider that you can simply add a page to a category and voila, the change is automagically propogated to the swanky CSS sidebar menu. Management will quake at the knees.
Anyway, for this, I was wondering how you could define a class to <a> tags generated by DPL2? So any links parsed by MW are just plain <a href="whatever"> but links parsed by DPL2 are more along the lines of <a href="whatever" class="supersecretCSSclass">
Then it's just a matter of dropping some CSS into http://yourwiki/wiki/MediaWiki:Common.css (Apart from the obvious having to setup .htc to make IE behave)

Closed

notnamespace

Is there a chance to add a notnamespace parameter? I have already added the code to my own copy of DPL2, but i have no access to the svn to contribute there.

If you want SVN commit access, contact Brion Vibber and read http://www.mediawiki.org/wiki/Subversion

Preparations:

    $aNamespaces         = array();
    $aExcludeNamespaces  = array();

Parsing parameters:

            case 'namespace':
            ... ...
            case 'notnamespace':
                $sArg=trim($sArg);
                $sNS = $wgContLang->getNsIndex($sArg);
                if ( $sNS != NULL )
                    $aExcludeNamespaces[] = $sNS;
                elseif (intval($sArg)>=0)
                    $aExcludeNamespaces[] = intval($sArg);
                break;

Building query:

    // Namespace IS ...
    ... ...
    // Namespace IS NOT ...
    if ( !empty($aExcludeNamespaces)) {
        $sSqlWhere .= ' AND (page_namespace NOT IN ( ' . implode (",", $aExcludeNamespaces) . ' ) ) ';
    }

There may be some other things around that i have forgotten, but this works for me... afaik -- jsimlo 16:38, 1 July 2006 (UTC)[reply]

Feature now available (using your code + small change to error handling so that notnamespace param can be used alone) in v0.5.1. Thanks. --Dangerville 02:54, 16 July 2006 (UTC)[reply]

MediaWiki 1.7.x

MediaWiki 1.7.1.

I'm running a fairly small MediaWiki 1.7.1 and the following simple list I need works without problems (can't comment on the rest of the options though, but they seemed to work fine as far as tested) ~gandm:

<DPL>
count=15
ordermethod=lastedit
shownamespace=false
namespace=0
</DPL>