Kunena 6.3.0 released

The Kunena team has announce the arrival of Kunena 6.3.0 [K 6.3.0] in stable which is now available for download as a native Joomla extension for J! 4.4.x/5.0.x/5.1.x. This version addresses most of the issues that were discovered in K 6.2 and issues discovered during the last development stages of K 6.3

Question [spoiler=título]texto[/spoiler] - Casi conseguido

More
14 years 7 months ago - 14 years 7 months ago #1 by Jhin
¡¡Buenos días a todos!!

Estoy intentando hacer un spoiler parecido a los que existen en IPB y VBulletin, que consiste en lo siguiente:
Code:
[spoiler=título]texto a ocultar[/spoiler]

SPOILER: título
Texto a ocultar

El caso es que el título funciona correctamente cuando es una sola palabra o número, pero cuando son más, solo muestra la primera. ¿Alguien sabe porque ocurre esto? Creoq ue tiene algo que ver con la variable "default", pero no se como cambiarla para que pille más de una palabra. Si alguien me pudiera ayudar, se lo agradecería mucho.

Os adjunto el código que parsea la tag
Warning: Spoiler!
Last edit: 14 years 7 months ago by Jhin.

Please Log in or Create an account to join the conversation.

More
14 years 7 months ago - 14 years 7 months ago #2 by JoniJnm
No he mirado ni probado el código, pero a ver si te ayuda esto:

El defaut: break; sólo se pone una vez por todos los cases, es decir:
Code:
switch ($var) { case 'a': //cosas para hacer si $var vale a break; case 'c': //cosas para hacer si $var vale b break; case 'b': //cosas para hacer si $var vale c break; default //cosas para hacer si $var no vale ninguno de las anteriores break; }
Si $var no vale ni a, ni b ni c hace lo de default, osea que tu código quedaría así
Code:
case 'spoiler': $tempstr = $tag->options['default']; if($between) { if ($this->spoilerid==0) { // Only need the script for the first spoiler we find $tag_new = '<script language = "JavaScript" type = "text/javascript">'. 'function fb_showDetail(srcElement) {'. 'var targetID, srcElement, targetElement, imgElementID, imgE lement;'. 'targetID = srcElement.id + "_details";'. 'imgElementID = srcElement.id + "_img";'. 'targetElement = document.getElementById(targetID);'. 'imgElement = document.getElementById(imgElementID);'. 'if (targetElement.style.display == "none") {'. 'targetElement.style.display = "";'. 'imgElement.src = "";'. '} else {'. 'targetElement.style.display = "none";'. 'imgElement.src = "";'. '}} </script>'; } else { $tag_new = ''; } $this->spoilerid++; $randomid = rand(); $tag_new .= '<div id="'.$randomid.'" onClick="java script:fb_showDetail(this);" style="cursor:pointer; "><img id="'.$randomid.'_img"'. 'src="" border="">'. (isset($tag->options["title"]) ? ($tag- >options["title"]) : ("<span class='alert'><b>SPOILER: </ b>".htmlspecialchars($tempstr, ENT_QUOTES)."</span>")) . '</strong></div><div id="'. $randomid . '_details" style="display: None;"><span class="fb_quote">' . $between . '</span></div>'; return TAGPARSER_RET_REPLACED; } return TAGPARSER_RET_NOTHING; break; default: break;
Pero el default break ya estará en el kunena.parser.php, así que sólo tendrás que añadir el case spoiler (o mejor, modificar el que hay)
Last edit: 14 years 7 months ago by JoniJnm.

Please Log in or Create an account to join the conversation.

Moderators: ssh
Time to create page: 0.460 seconds