From fc7369835258467bf97eb64f184b93691f9a9fd5 Mon Sep 17 00:00:00 2001 From: Yaco Date: Thu, 4 Jun 2020 11:01:00 -0300 Subject: first commit --- .../CategoryByList/CategoryByListHooks.php | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 www/wiki/extensions/CategoryByList/CategoryByListHooks.php (limited to 'www/wiki/extensions/CategoryByList/CategoryByListHooks.php') diff --git a/www/wiki/extensions/CategoryByList/CategoryByListHooks.php b/www/wiki/extensions/CategoryByList/CategoryByListHooks.php new file mode 100644 index 00000000..d99795af --- /dev/null +++ b/www/wiki/extensions/CategoryByList/CategoryByListHooks.php @@ -0,0 +1,24 @@ +setFunctionHook( 'CategoryByList', [ self::class, 'CategoryByList' ] ); + } + + // Render the output of {{#example:}}. + public static function CategoryByList( Parser $parser, $param1 = '', $param2 = '', $param3 = '' ) { + + // The input parameters are wikitext with templates expanded. + // The output should be wikitext too. + $output = ""; + + $categories = explode(', ', $param1); + foreach ($categories as $item) { + $output .= '[[Categoría:'.$item.']]'; + } + + return $output; + } +} -- cgit v1.2.1