Extension talk:ToggleDisplay2

MediaWiki 1.16.1 -Does not work for me
I have tested both versions of this extension but it doesn't show any text between the two tags, see

Source

text before  hidable text text after

Are the some other extensions which have to be installed or some php parameters to be set ?

My System configuration:

Produkt 	Version MediaWiki 	1.16.1 PHP 	       5.3.2-1ubuntu4.7 (apache2handler) MySQL 	       5.1.41-3ubuntu12.7

Thanks for help, greets, michael. --82.136.114.78 10:39, 22 January 2011 (UTC)


 * Hi Michael, no this extension does not require any other extensions or php parameters to be set. Your example source works fine in my two 1.16.0 wikis. I do not have access to a 1.16.1 Wiki, I also have different (older) PHP and MySQL versions (although I don't think that's the problem). You might want to check the Special:Version page of your wiki to check if this extension was installed successfully (and check if the tag is listed in the Parser extension tags section). If it's not, please check if your LocalSettings.php contains the  line and whether the extension php file is really located at that path. Hope this helps. --Roberthaenel 00:13, 23 January 2011 (UTC)


 * Hi there, I have exactly the same problem. Install all went OK and the text between the tags is hidden as expected. However, there is no [show details] link to click and make the text appear. After reading this post I rolled back from 1.16.1 to 1.16.0 but it made no difference. Re the questions above, the extension is listed on the version page, and the tag is listed there also. I am running PHP 5.3.5 and MySQL 5.5.8. Maybe it is a PHP issue? Any help or suggestions would be appreciated. Thanks, Mark. Mark


 * Hi again. I did not realise you were the author, Robert, until I went back to this page. Thanks for a great extension, I can't wait to get it going!! Mark.


 * Hi, I have installed a test server with PHP 5.2.3 and MySQL 5.0.41 and the extension works correctly. It is looking more like a PHP issue now. Any thoughts Robert? Thanks, Mark.

If it's still not working for you, please check the page source (CTRL + U in Firefox). For me Michael's example (see above) produces the following HTML:
 * Hi Mark, yes it looks indeed like this issue might be related to PHP 5.3, but I also found an issue with the source code I posted here (somehow an extra line break was inserted when I pasted the code, which messed up the HTML output of the extension). This is fixed now. In fact, I rewrote the part where the HTML is generated. Although I don't think that this was related to your problem, you might want to try to use the updated code.


 * Please compare to your output and let me know which part exactly is missing. In the mean time I will try to get access to a wiki with PHP 5.3... --Roberthaenel 04:19, 24 January 2011 (UTC)


 * Hi and thanks for the quick response! I have updated your code and still have the same problem, with the link not showing, on PHP 5.3. The PHP is not inserting any of the '$result' string at all into the HTML output. Below is the page source for me. (BTW, the javascript function is in the source listing OK a bit further up the page).
 * The easiest way to test it on PHP 5.3 might be to download a portable setup, such as the latest Uniform Server (if using Windows). It will just run from the downloaded folder after a quick configuration. Then just pop a clean copy of MediaWiki in the WWW folder, a quick config of that and you will be up and running! This is what I did to test PHP 5.2 - I downloaded an old version of Uniform Server. Mark.


 * Hi, the issue is fixed now. The problem was the function that does the rendering not being called, because it seems that passing variables by reference with a  is not supported anymore with PHP 5.3. After removing the   it works fine with my PHP 5.3.2 as well as older 5.x setups. Thanks for all your suggestions in localizing the problem. --Roberthaenel 12:18, 25 January 2011 (UTC)


 * Hi. All fixed!! Thanks for your help! Mark.

Possible Layout Change
Would it be easy to modify this to display the [Show Less] link after the text that is expanded?

I would like it to emulate the '...more' and '...less' notations often used in blogs. After the text is expanded with the '...more' link, I would like the '...less' link to appear at the end of the expanded text.

Thanks, Mark.


 * Hi Mark, yes, that quite simple: please look for the following line in the code (this is where the show/hide link is generated):


 * ... and then just cut and paste it three lines below (after the  line). Maybe I will add an option later to switch between this and the default behavior. --Roberthaenel 04:24, 24 January 2011 (UTC)


 * Thanks. I had been playing around and worked out something similar so all good. Mark.

Change Tags
I am not sure how tags are allocated in MediaWiki and what stops several extensions using the same tag, with obvious conflicts! Anyway, if there is no control over the tags in general, is it possible to change the tags used with ToggleDisplay? For example, it is easier to type (and remember) '' than '' in an article. I found where this can be changed in $parser->setHook( 'ToggleDisplay', 'efToggleDisplayRender' ); but wonder if this is allowed, and whether it could it be stored in the array at the start of the code? Mark.


 * I currently do not plan to rename the tag, because I want this extension to be backward compatible with the original ToggleDisplay extension and don't want users that are migrating to ToggleDisplay2 to have to change all their pages where the tag appeared. However, you are of course free to change the tag name in your wiki as you wish: just change the line you already found to, for example:

$parser->setHook( 'hide', 'efToggleDisplayRender' );
 * That's all that is required to be able to use ' ' instead of '. --Roberthaenel 12:37, 25 January 2011 (UTC)