Extension talk:DynamicFunctions

From mediawiki.org
Latest comment: 14 years ago by Timeroot in topic #ip could be a privacy hazard
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).

I've no clue what #arg: is supposed to do. -- Omniplex (w:t) 17:50, 21 May 2006 (UTC)Reply

#arg looks for URL arguments in the page location. This allows a single page to perform multiple functions depending on the arguments given to it. For a simple example, go here and click the increment/decrement links a few times. For a more complex example: Tic Tac Toe --Algorithm 21:23, 21 May 2006 (UTC)Reply
No clearer, sorry, and those pages fail to load. HTH HAND —Phil | Talk 10:15, 22 May 2006 (UTC)Reply
Yeah, my host had a server hiccup. It's back up now. Anyway, to clarify further:
#arg looks at the page location, and parses the URL arguments. For example, if the location were http://meta.wikimedia.org/w/index.php?title=Talk:DynamicFunctions&foo=bar, then {{#arg:foo}} would return bar. Combine this with ParserFunctions, and you have all the ingredients to create dynamic interfaces, like the Tic Tac Toe example above. --Algorithm 10:53, 22 May 2006 (UTC)Reply
Interesting!--Patrick 15:51, 22 May 2006 (UTC)Reply
Okay, it decomposes the query string (if any) into name=value pairs, and returns the last (?) value for a given name, if that name exists in the query string. CGI for templates, nice... ;-) -- Omniplex (w:t) 11:30, 6 June 2006 (UTC)Reply

#skin on Wikipedia[edit]

Why doesn't #skin work on Wikipedia? It would be very useful to me to have it so that I can find my .css and .js file. - Lady Aleena @ 13:56, 11 August 2006 (UTC)Reply

DynamicFunctions are not installed on MediaWiki, and are unlikely to be installed anytime soon. DynamicFunctions don't work with the cache, either you neeed to hit action=purge every time you view the page, or caching is disabled on pages that use these functions (which the developers said they won't do, due to the increased server load it would produce), or the cache would be disabled altogether, which is not an option on WikiMedia. Polonium 01:14, 16 January 2007 (UTC)Reply
if you want to test DynamicFunctions, here is a wiki that has them installed [1]. Polonium 01:15, 16 January 2007 (UTC)Reply

#rand: and default values[edit]

On my private wiki, I have attempted to use #rand: with just one parameter, and it's behaving oddly. For any call of #rand: with a parameter of 3 or more, the function never returns a value lower than 3. (I haven't tested the results with parameters of 1 and 2, but I'll check that out when I get home tonight.) Could this be because the default value of the second parameter of #rand: is 1, so that the PHP function mt_rand is asked to find a random number from 3 to 1, for instance? Is the behavior of mt_rand defined in the case that the second parameter is lower than the first? Or should I look for the source of my error somewhere else? —Stormraven (talk · contribs) 18:14, 23 February 2009 (UTC)Reply

I've confirmed, for single parameters of 1, 2 or 3, the result is always 1, 2 and 3, respectively. For parameters of 4 and higher, the result is a random number from 3 to the value of the parameter. —Stormraven (talk · contribs) 12:49, 25 February 2009 (UTC)Reply

Install[edit]

How to install this extension? Зелёный Кошак 01:06, 5 August 2009 (UTC)Reply

make a file DynamicFunctions.php, copy the code (probably from below Update 1.8) into it, create the Folder DynamicFunctions/ in your wiki/extensions folder, move the DynamicFunctions.php file into it and last but not least: Add the following line to your LocalSettings.php : "include_once('extensions/DynamicFunctions/includes/DynamicFunctions.php');" best regards, krueger73

Thanks. Зелёный Кошак 01:37, 11 August 2009 (UTC)Reply

does not work with PHP 5.3[edit]

After I upgraded PHP to Version 5.3 this extension does not work for my anymore. I get this message on every page where I set the comments tag. Warning: Parameter 1 to Language::getMagic() expected to be a reference, value given in ...\includes\StubObject.php on line 58

Look here for more information: Hooks not working for PHP 5.3.0 Monon 14:50, 2 October 2009 (UTC)Reply

#ip could be a privacy hazard[edit]

"#ip" function could remove the privacy of Usernames. Imagine I'd created a page "User:Timeroot/Sandbox" with the text "{{subst:User:Timeroot/Sandbox}}{{subst:#ip}}", and transcluded it at the top of "User_talk:Timeroot". Then, anytime someone commented, the template would (a) substitute itself, so next time it would work again, and (b) substitute the user's IP Address. Pretty soon, I might gather the IP Addresses of many people - or, if I put that in my signature (and not enough people noticed to remove them all) I might soon have hundreds of IP addresses. VERY DANGEROUS. All that needs to be done, I feel, is add some code to this extension that prevents the #ip function from being substituted. Thank you! Timeroot TalkContribsEdit Count 07:44, 3 January 2010 (UTC)Reply