https://www.icyphoenix.com/viewtopic.php?f=35&t=773 ----------------------------------- Zuker Fri 05 Jan, 2007 18:52 Need help to parse bbcode at xs ----------------------------------- I'm installing a new bbcode for my xs and i need help :mrgreen: I don't know how to parse this like xs bbcode.php OPEN [code linenumbers=false][code linenumbers=false]templates/subSilver/bbcode.tpl[/code][/code] FIND [code linenumbers=false][/code] AFTER, ADD [code linenumbers=false][/code] OPEN [code linenumbers=false]includes/bbcode.php[/code] FIND [code linenumbers=false] $bbcode_tpl['img'] = str_replace('{URL}', '1', $bbcode_tpl['img']);[/code] AFTER, ADD [code linenumbers=false] $bbcode_tpl['imgreflect'] = str_replace('{URL}', '1', $bbcode_tpl['imgreflect']); [/code] FIND [code linenumbers=false] // [img]image_url_here[/img] code.. // This one gets first-passed.. $patterns[] = "#[img:$uid]([^?](?:[^[]+|[(?!url))*?)[/img:$uid]#i"; $replacements[] = $bbcode_tpl['img'];[/code] AFTER, ADD [code linenumbers=false] $patterns[] = "#[imgreflect:$uid]([^?](?:[^[]+|[(?!url))*?)[/imgreflect:$uid]#i"; $replacements[] = $bbcode_tpl['imgreflect']; [/code] FIND [code linenumbers=false] // [img]image_url_here[/img] code.. $text = preg_replace("#[img]((http|ftp|https|ftps)://)([^ ?&=#"nrt<]*?(.(jpg|jpeg|gif|png)))[/img]#sie", "'[img:$uid]1' . str_replace(' ', '%20', '3') . '[/img:$uid]'", $text);[/code] AFTER, ADD [code linenumbers=false] $text = preg_replace("#[imgreflect]((http|ftp|https|ftps)://)([^ ?&=#"nrt<]*?(.(jpg|jpeg|gif|png)))[/imgreflect]#sie", "'[imgreflect:$uid]1' . str_replace(' ', '%20', '3') . '[/imgreflect:$uid]'", $text);[/code] ----------------------------------- Leon Fri 05 Jan, 2007 20:29 Re: Need Help To Parse Bbcode At Xs ----------------------------------- in bbcode.php find: // LIST before add: if($tag === 'imgreflect') { if($this->is_sig) { return $error; } // generate html $html = '
'; return array( 'valid' => true, 'html' => $html ); } Use this tag when post: [code] [imgreflect]link img[/imgreflect] [/code] ----------------------------------- Zuker Fri 05 Jan, 2007 21:20 Re: Need help to parse bbcode at xs ----------------------------------- with that only change doesn't work ----------------------------------- Leon Fri 05 Jan, 2007 22:16 Re: Need Help To Parse Bbcode At Xs ----------------------------------- [quote user="Zuker" post="6294"]with that only change doesn't work[/quote] you will need additional JS upload to your root server , and in overall_header.tpl add this line: ----------------------------------- difus Sat 06 Jan, 2007 00:11 Re: Need help to parse bbcode at xs ----------------------------------- It is for vanilla bbcode :wink: ----------------------------------- Leon Sat 06 Jan, 2007 04:42 Re: Need Help To Parse Bbcode At Xs ----------------------------------- I did this and it works => check the demo link : http://www.tinhoi.exofire.net/forum/viewtopic.php?t=5 Here is my version, not sure if i did it right way but at least it works : first upload reflection.js to forum root open includes/bbcode.php [code linenumbers=false]find: 'img' => array( 'nested' => false, 'inurl' => true, ), after add: 'imgreflect' => array( 'nested' => false, 'inurl' => true, ), find: // ALBUMIMG before add: // IMG REFLECT if($tag === 'imgreflect') { if($this->is_sig) { return $error; } // main parameters $params = array( 'src' => false, 'alt' => false, 'slide' => false, ); // additional allowed parameters $extras = $this->allow_styling ? array('width', 'height', 'border', 'style', 'class', 'title', 'align') : array('width', 'height', 'border', 'title', 'align'); // [img=blah]blah2[/img] if(isset($item['params']['param'])) { $params['src'] = $item['params']['param']; if ( $config_mg['thumbnail_posts'] == 1 ) { $params['src'] = "image_thumbnail.php?pic_id=" . $params['src']; } $params['alt'] = $content; $params['slide'] = isset($item['params']['slide']) ? $item['params']['slide'] : ''; $slideshow = ($params['slide']) ? 'lightbox[' . $item['params']['slide'] . ']' : 'lightbox'; } // [img src=blah alt=blah width=123][/img ] elseif(isset($item['params']['src'])) { $params['src'] = $item['params']['src']; if ( $config_mg['thumbnail_posts'] == 1 ) { $params['src'] = "image_thumbnail.php?pic_id=" . $params['src']; } $params['alt'] = isset($item['params']['alt']) ? $item['params']['alt'] : $content; $params['slide'] = isset($item['params']['slide']) ? $item['params']['slide'] : ''; $slideshow = ($params['slide']) ? 'lightbox[' . $item['params']['slide'] . ']': 'lightbox'; for($i=0; $ivalid_style($item['params']['style']); if($style !== false) { $params['style'] = $style; } } else { $params[$extras[$i]] = $item['params'][$extras[$i]]; } } } } // [img]blah[/img], [img width=blah]blah[/img ] elseif(!empty($content)) { $link_url = $content; $params['src'] = $content; // LIW - BEGIN if ( ($board_config['liw_enabled'] == 1) && ($max_image_width > 0) && ($config_mg['thumbnail_posts'] == 0) ) { if ( isset($item['params']['width']) ) { $item['params']['width'] = ( $item['params']['width'] > $max_image_width ) ? $max_image_width : $item['params']['width']; } else { $image_size = @getimagesize($content); $item['params']['width'] = ( $image_size[0] > $max_image_width ) ? $max_image_width : $image_size[0]; } } elseif ( $config_mg['thumbnail_posts'] == 1 ) { /* $image_size = @getimagesize($content); if ($image_size[0] > $config_mg['thumbnail_size']) { $params['src'] = "image_thumbnail.php?pic_id=" . $params['src']; } */ $params['src'] = "image_thumbnail.php?pic_id=" . $params['src']; } // LIW - END $params['alt'] = isset($item['params']['alt']) ? $item['params']['alt'] : (isset($params['title']) ? $params['title'] : 'Image'); $params['slide'] = isset($item['params']['slide']) ? $item['params']['slide'] : ''; $slideshow = ($params['slide']) ? 'lightbox[' . $item['params']['slide'] . ']': 'lightbox'; for($i=0; $ivalid_style($item['params']['style']); if($style !== false) { $params['style'] = $style; } } else { $params[$extras[$i]] = $item['params'][$extras[$i]]; } } } } // generate html $html = ' $value) { $html .= ' ' . $var . '="' . $this->process_text($value) . '"'; } if(!isset($params['title'])) { $html .= ' title="' . $this->process_text($params['alt']) . '"'; } $html .= ' class="reflect rheight33" />'; // add url if(empty($item['inurl'])) { if ( $config_mg['thumbnail_posts'] == 1 && $config_mg['thumbnail_lightbox'] == 1 ) { $html = '' . $html . ''; } else { $html = '' . $html . ''; } } return array( 'valid' => true, 'html' => $html, 'allow_nested' => false, ); }[/code] Open templates/ca_adphrodite/viewtopic_body.tpl find:
before add: that's it Download reflection.js here : http://www.tinhoi.exofire.net/forum/reflection.js <=== Right click on link and Save Target As ----------------------------------- Zuker Sun 07 Jan, 2007 02:14 Re: Need help to parse bbcode at xs ----------------------------------- i can't make it run take a look plz at my bbcode.php www.superzuker.com.ar/shared/bbcode.rar ----------------------------------- Leon Sun 07 Jan, 2007 03:53 Re: Need Help To Parse Bbcode At Xs ----------------------------------- I looked on your bbcode file, looks like you did everything right though, make sure you add JS in viewtopic_body.tpl too here is the post on my main forum you can look at, the above demo link is on my test forum http://tinhthienthu.ath.cx/viewtopic.php?p=490#490 or here: http://tinhthienthu.ath.cx/viewtopic.php?p=486#486 ----------------------------------- Zuker Sun 07 Jan, 2007 05:44 Re: Need help to parse bbcode at xs ----------------------------------- :lol: it was working, but the bbcode doens't got a preview, that's because i said it didnt work ----------------------------------- Leon Sun 07 Jan, 2007 09:37 Re: Need Help To Parse Bbcode At Xs ----------------------------------- [quote user="Zuker" post="6351"]:lol: it was working, but the bbcode doens't got a preview, that's because i said it didnt work[/quote] it should work if you add this line to posting_topic_review.tpl ----------------------------------- Zuker Sun 07 Jan, 2007 14:16 Re: Need help to parse bbcode at xs ----------------------------------- adding to overall header it isn't enought? why don't u add the efecto to the "js's" folder?? Later, you must got this ----------------------------------- Leon Sun 07 Jan, 2007 19:08 Re: Need Help To Parse Bbcode At Xs ----------------------------------- i dont know but when i add it to overall_header.tpl it doesnt work ...so i dont mind to add it in vewtopic_body.tpl instead and i think if you put the effect in root folder it will respond faster ----------------------------------- Mighty Gorgon Sun 07 Jan, 2007 20:09 Re: Need help to parse bbcode at xs ----------------------------------- Nice effect... can you try to attach here premodified files so I can have a look? Thank you! :wink: ----------------------------------- Zuker Sun 07 Jan, 2007 20:40 Re: Need help to parse bbcode at xs ----------------------------------- yes mighty i'm working on a bottom also, but i'll attach here premodified files in a moment ----------------------------------- Zuker Sun 07 Jan, 2007 20:48 Re: Need help to parse bbcode at xs ----------------------------------- :mrgreen: files working for old a69 ----------------------------------- Mighty Gorgon Sun 07 Jan, 2007 20:52 Re: Need help to parse bbcode at xs ----------------------------------- Ok, I'll test it. :wink: I won't add it in the final release, but it is a cool addon. ----------------------------------- Zuker Sun 07 Jan, 2007 20:55 Re: Need help to parse bbcode at xs ----------------------------------- yes luca i'll release a "mini mod" for users with a bottom tonight or tomorrow. But i'm waiting icy phoenix files :mrgreen: ----------------------------------- Mighty Gorgon Sun 07 Jan, 2007 21:13 Re: Need help to parse bbcode at xs ----------------------------------- As soon as I can fix a couple of bugs, I'll release the beta... all the other files are ready to be published... :wink: ----------------------------------- Zuker Mon 08 Jan, 2007 12:16 Re: Need help to parse bbcode at xs ----------------------------------- Said and done http://www.icyphoenix.com/viewtopic.php?p=6450#p6450 ----------------------------------- Mighty Gorgon Mon 08 Jan, 2007 14:58 Re: Need help to parse bbcode at xs ----------------------------------- Great... I'll have a try after releasing the Beta. :wink: