Talk:Skinny

From Organic Design wiki

Hook development

I've checked the parser code and found that the place where the template content is expanded already has the parameters available if any were supplied after the template name, they're in $argc and $args. They're there because the same code is used for handling the variables which use the same parameter method. So we can easily add a hook at this point which can do the replacement of the tokens if any args exist. --Nad 02:17, 26 Feb 2007 (NZST)
I've added a new hook into the parser called ExpandTemplate which allows the text of the template to be modified based on the args before being transcluded. It's been added to xwadmin.php which automatically adds or removes the index.php and parser.php patches. The same line can be added without any changes to a MediaWiki 1.5.x or 1.6.x as well.
I've added a function to the new hook in LocalSettings.php which will do the token replacement, it currently just creates a message if there are any arguments when it expands a template

Testing

The following test template being added and shows up in blue below, it has variables such as sitename which must also expand to test if the new method works in a recursive situation properly.

{{MediaWiki:sitestatstext|foo|bar|baz}}

MediaWiki:Sitestatstext