|
Page 1 of 2
|
Zuker 
Joined: August 2006
Posts: 2134
Location:  BA
|
 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);
____________ ? Zuker - EDDB - LPM - Sharefields
|
#1 Fri 05 Jan, 2007 18:52 |
|
Sponsors

|
Icy Phoenix is an open source project, you can show your appreciation and support future development by donating to the project.
|
|
Leon
Joined: November 2006
Posts: 46
|
 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]
-
|
#2 Fri 05 Jan, 2007 20:29 |
|
Zuker 
Joined: August 2006
Posts: 2134
Location:  BA
|
 Re: Need help to parse bbcode at xs
with that only change doesn't work
____________ ? Zuker - EDDB - LPM - Sharefields
|
#3 Fri 05 Jan, 2007 21:20 |
|
Leon
Joined: November 2006
Posts: 46
|
 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>
|
#4 Fri 05 Jan, 2007 22:16 |
|
difus 
Joined: August 2006
Posts: 763
Location:
|
 Re: Need help to parse bbcode at xs
It is for vanilla bbcode
|
#5 Sat 06 Jan, 2007 00:11 |
|
Leon
Joined: November 2006
Posts: 46
|
 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
Edited by Zuker, Sun 07 Jan, 2007 01:51: added code tag's |
#6 Sat 06 Jan, 2007 04:42 |
|
Zuker 
Joined: August 2006
Posts: 2134
Location:  BA
|
 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
____________ ? Zuker - EDDB - LPM - Sharefields
|
#9 Sun 07 Jan, 2007 05:44 |
|
Leon
Joined: November 2006
Posts: 46
|
 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
|
#10 Sun 07 Jan, 2007 09:37 |
|
Zuker 
Joined: August 2006
Posts: 2134
Location:  BA
|
 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>
____________ ? Zuker - EDDB - LPM - Sharefields
|
#11 Sun 07 Jan, 2007 14:16 |
|
Leon
Joined: November 2006
Posts: 46
|
 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
|
#12 Sun 07 Jan, 2007 19:08 |
|
Mighty Gorgon 
Luca Libralato
Joined: August 2006
Posts: 7192
Location:  Borgo San Michele
|
 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!
____________ Luca
SEARCH is the quickest way to get support.
Icy Phoenix ColorizeIt - CustomIcy - HON
|
#13 Sun 07 Jan, 2007 20:09 |
|
Zuker 
Joined: August 2006
Posts: 2134
Location:  BA
|
 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 - EDDB - LPM - Sharefields
|
#14 Sun 07 Jan, 2007 20:40 |
|
Zuker 
Joined: August 2006
Posts: 2134
Location:  BA
|
 Re: Need help to parse bbcode at xs
 files working for old a69
Description: |
Based in a69_20061208_1044 files |
 Download |
Filename: |
reflection.rar |
Filesize: |
27.44 KB |
Downloaded: |
154 Time(s) |
____________ ? Zuker - EDDB - LPM - Sharefields
|
#15 Sun 07 Jan, 2007 20:48 |
|
|
Page 1 of 2
|
Was this topic useful?
Was this topic useful?
Link this topic |
URL |
|
BBCode |
|
HTML |
|
You cannot post new topics You cannot reply to topics You cannot edit your posts You cannot delete your posts You cannot vote in polls You cannot attach files You can download files You cannot post calendar events
|
|
|
|