Icy Phoenix
Old Support Topics - Need help to parse bbcode at xs
Zuker [ Fri 05 Jan, 2007 18:52 ]
Post subject: Need help to parse bbcode at xs
I'm installing a new bbcode for my xs and i need help
I don't know how to parse this like xs bbcode.php
OPEN
[code linenumbers=false]templates/subSilver/bbcode.tpl[/code]
FIND
<!-- BEGIN img --><img src="{URL}" border="0" /><!-- END img -->
AFTER, ADD
<!-- BEGIN imgreflect --><img src="{URL}" class="reflect rheight33" /><!-- END imgreflect -->
OPEN
FIND
$bbcode_tpl['img'] = str_replace('{URL}', '1', $bbcode_tpl['img']);
AFTER, ADD
$bbcode_tpl['imgreflect'] = str_replace('{URL}', '1', $bbcode_tpl['imgreflect']);
FIND
// [img]image_url_here[/img] code..
// This one gets first-passed..
$patterns[] = "#[img:$uid]([^?](?:[^[]+|[(?!url))*?)[/img:$uid]#i";
$replacements[] = $bbcode_tpl['img'];
AFTER, ADD
$patterns[] = "#[imgreflect:$uid]([^?](?:[^[]+|[(?!url))*?)[/imgreflect:$uid]#i";
$replacements[] = $bbcode_tpl['imgreflect'];
FIND
// [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);
AFTER, ADD
$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);
Leon [ Fri 05 Jan, 2007 20:29 ]
Post subject: 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 = '<div id="reflect rheight33"><img src="' . $content . '" width="' . $width . '" height="' . $height . '" class="reflect rheight33" /></div>';
return array(
'valid' => true,
'html' => $html
);
}
Use this tag when post:
- [imgreflect]link img[/imgreflect]
-
Zuker [ Fri 05 Jan, 2007 21:20 ]
Post subject: Re: Need help to parse bbcode at xs
with that only change doesn't work
Leon [ Fri 05 Jan, 2007 22:16 ]
Post subject: Re: Need Help To Parse Bbcode At Xs
with that only change doesn't work
you will need additional JS upload to your root server , and in overall_header.tpl add this line:
<script type="text/javascript" src="reflection.js"></script>
difus [ Sat 06 Jan, 2007 00:11 ]
Post subject: Re: Need help to parse bbcode at xs
It is for vanilla bbcode

Leon [ Sat 06 Jan, 2007 04:42 ]
Post subject: 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
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; $i<count($extras); $i++)
{
if(!empty($item['params'][$extras[$i]]))
{
if($extras[$i] === 'style')
{
$style = $this->valid_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; $i<count($extras); $i++)
{
if(!empty($item['params'][$extras[$i]]))
{
if($extras[$i] === 'style')
{
$style = $this->valid_style($item['params']['style']);
if($style !== false)
{
$params['style'] = $style;
}
}
else
{
$params[$extras[$i]] = $item['params'][$extras[$i]];
}
}
}
}
// generate html
$html = '<img';
foreach($params as $var => $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 = '<a href="' . $link_url . '" rel="' . $slideshow . '" title="' . $params['alt'] . '">' . $html . '</a>';
}
else
{
$html = '<a href="' . $params['src'] . '" target="_blank" title="' . $lang['OpenNewWindow'] . '">' . $html . '</a>';
}
}
return array(
'valid' => true,
'html' => $html,
'allow_nested' => false,
);
}
Open templates/ca_adphrodite/viewtopic_body.tpl
find:
<div class="forumline nav-div">
before add:
<script type="text/javascript" src="reflection.js"></script>
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 05:44 ]
Post subject: Re: Need help to parse bbcode at xs
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 ]
Post subject: Re: Need Help To Parse Bbcode At Xs
it was working, but the bbcode doens't got a preview, that's because i said it didnt work
it should work if you add this line
<script type="text/javascript" src="reflection.js"></script>
to posting_topic_review.tpl
Zuker [ Sun 07 Jan, 2007 14:16 ]
Post subject: 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
<script type="text/javascript" src="templates/ca_aphrodite/js/reflection.js"></script>
Leon [ Sun 07 Jan, 2007 19:08 ]
Post subject: 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 ]
Post subject: 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!

Zuker [ Sun 07 Jan, 2007 20:40 ]
Post subject: 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 ]
Post subject: Re: Need help to parse bbcode at xs

files working for old a69
Mighty Gorgon [ Sun 07 Jan, 2007 20:52 ]
Post subject: Re: Need help to parse bbcode at xs
Ok, I'll test it.
I won't add it in the final release, but it is a cool addon.
Zuker [ Sun 07 Jan, 2007 20:55 ]
Post subject: 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

Mighty Gorgon [ Sun 07 Jan, 2007 21:13 ]
Post subject: 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...

Zuker [ Mon 08 Jan, 2007 12:16 ]
Post subject: Re: Need help to parse bbcode at xs
Mighty Gorgon [ Mon 08 Jan, 2007 14:58 ]
Post subject: Re: Need help to parse bbcode at xs
Great... I'll have a try after releasing the Beta.
