Issue:Category option that does AND operation to multiple parameters
From FollowTheScore
Revision as of 15:59, 1 March 2008 by Eclecticdave (talk | contribs) (New page: {{Issue |Type = Change Request |Extension = DPL |Version = 1.6.7 |Description = |Status = open }} == Problem == I made a small enhancement to DPL to support a 'cat...)
Description: | |
Extension / Version: | DPL / 1.6.7 |
Type / Status: | Change Request / open |
Problem
I made a small enhancement to DPL to support a 'categoryall' option. Given multiple parameters it does an AND operation on them instead of an OR. The reason for doing this is I'm generating the DPL query dynamically and I couldn't see a way of creating multiple 'category' options - it's much easier working with a simple list.
It's a bit simplified compared to 'category' - it doesn't handle the '+', '-' or '*' modifiers, but for your consideration please find the patch below ...
Eclecticdave 14:59, 1 March 2008 (CET)
diff --git a/DynamicPageList2.php b/DynamicPageList2.php index bc02203..6d391b2 100644 --- a/DynamicPageList2.php +++ b/DynamicPageList2.php @@ -344,6 +344,7 @@ class ExtDynamicPageList2 * @todo define 'category' options (retrieve list of categories from 'categorylinks' table?) */ 'category' => NULL, + 'categoryall' => NULL, 'categorymatch' => NULL, 'categoryregexp' => NULL, /** @@ -1371,6 +1372,17 @@ class ExtDynamicPageList2 $bConflictsWithOpenReferences=true; } break; + case 'categoryall': + $aParams = explode('|', $sArg); + foreach($aParams as $sParam) { + $sParam=trim($sParam); + if($sParam == '') { + // Include uncategorized pages + $bIncludeUncat = true; + } + $aIncludeCategories[] = array($sParam); + } + break; case 'notcategoryregexp': $sNotCategoryComparisonMode = ' REGEXP '; @@ -3933,4 +3945,4 @@ class DPL2Logger { } -?> \ No newline at end of file +?>