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.


 * Top, Bottom or BOTH would be nice...long text areas would benefit from the top & bottom links for the 'Show Less' state.--GillianBates 14 August 2011

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)

Is it possible to use Internationalized messages for Show and Hide details
Robert,

Thanks for this very nice extension, which makes it easy to hide lengthy portions of text in an article. I can't refer you to a wiki where I have it running yet, since our beta test is behind a .htaccess password prompt, which I don't want to post in a forum.

However, I am wondering what would be involved in making the 'showtext' => '[show details]', 'hidetext' => '[hide details]',

display in the language used by the logged in user? Our wiki supports, English, French, German, and Spanish using the Languages template. In other words, how would I define it as a message that could be overridden in the Special:AllMessages for when the pages are displayed in French, German, or Spanish.

By the way, I preferred to display the Hide details after the text, so I edited the code based on a previous response on this talk page, so that would certainly be a nice option to set.

Thanks in Advanced. --Ken Roy 18:37, 25 March 2011 (UTC)
 * Using the additional parameter syntax, a page written in French could use the following
 * so it may not be necessary to create the ToggleDisplay2.i18n.php file.
 * so it may not be necessary to create the ToggleDisplay2.i18n.php file.


 * Robert, thanks again for this extension. It is a lot nicer than using collapsible and collapsed tables, just to collapse text sections of a page that would normally not be in a table. --Ken Roy 11:49, 27 March 2011 (UTC)

Substituting Images for the Show More and Hide More text
Greetings Robert...thank you for the simple, useful and effective extension. I would love to see a feature that allows a pair of Images to be used in place of the text links. Users do love their icon buttons :-)

Is this something that might be easily and cleanly added to this extension?