• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

BB Code Manager

Status
Not open for further replies.
Hehe, as soon as I saw the help page bit I thought, I could combine my table tags there and sure enough....:D
 
Like this add-on.
Just one usability flaw, at least for me.

I need a bbCode to integrate local video (video tutorials) in forum posts.
I had to hard-code in the /library/KingK/BbCodeManager/BbCode/Formatter/Default.php file to get it to work. Well, I'm pretty proud that I managed to do it, but I don't feel very well, hard-coding in an add-on file, since this makes future updates more tricky.

Let's assume the following, as an example for explanation:

[vid]folder/subfolder[/vid]
This would be the bbCode I need and the parameter inside the tag has to appear in more than one place of the HTML that is generated by the bbCode. Impossible to achieve with the options in AdminCP, so I'm forced to edit the above file.

I wonder if there's a way to make file edits obsolete ... like using a multiline text field in the bbCode settings and an easy standard for parameters and options like for example $param[0], &param[1], $option[0], $option[1], etc.
 
Like this add-on.
Just one usability flaw, at least for me.

I need a bbCode to integrate local video (video tutorials) in forum posts.
I had to hard-code in the /library/KingK/BbCodeManager/BbCode/Formatter/Default.php file to get it to work. Well, I'm pretty proud that I managed to do it, but I don't feel very well, hard-coding in an add-on file, since this makes future updates more tricky.

Let's assume the following, as an example for explanation:

[vid]folder/subfolder[/vid]
This would be the bbCode I need and the parameter inside the tag has to appear in more than one place of the HTML that is generated by the bbCode. Impossible to achieve with the options in AdminCP, so I'm forced to edit the above file.

I wonder if there's a way to make file edits obsolete ... like using a multiline text field in the bbCode settings and an easy standard for parameters and options like for example $param[0], &param[1], $option[0], $option[1], etc.
I'm not sure what you edited (in Default) but if you are just doing embed codes, use 'advanced' options and place {1} everywhere you want the url... Or is the parameter the URL to the video...?
 
Simple Replacement Start and Simple Replacement End as separate single line text fields looks somewhat unnecessarily complicated and unflexible to me. I'll try to demonstrate:

<!-- Your approach -->
some html code in simple replacement start line $param[0] some more code in simple replacement end

<!-- my wish -->
html code $param[0] in a multiline text $param[0] field
where I can place the $param[0] where I want and
$param[0] as often as I want.

Hope this makes is more obvious, what I'm talking about.[/quote]
 
Simple Replacement Start and Simple Replacement End as separate single line text fields looks somewhat unnecessarily complicated and unflexible to me. I'll try to demonstrate:



Hope this makes is more obvious, what I'm talking about.
[/quote]
It does. I thought you needed to use the options. Unfortunately, the simple replacements were designed to fit perfectly with XenForo's BBCode parser. The way the text fields are set up, is the way it works in XenForo. What you would like to do would require a PHP Callback (The reason this was added actually) and you wouldn't need to edit any files. If you wouldn't mind posting the edits you made to the Default.php and I can explain how to transfer them elsewhere?
 
Wow, looks like I figured it out on my own after you gave me the hint. :)
Let me show you ... and correct me please, if I'm wrong.

I created a new PHP file inside /library/KingK/BbCodeManager/BbCode/Formatter/
This new file (say lbx.php) contains the following (dummy code):

Code:
<?php

class KingK_BbCodeManager_BbCode_Formatter_lbx
// unique class name (see lbx at the end)
{
	public static function parseTagTraining(array $tag, array $rendererStates, &$parentClass)
	{
		$src = $tag['children'][0];
		return 'this is my html code with the tag child #0 appearing here: ' . $src . ' and here: ' . $src;
	}
	
}

?>

And this file and the class inside are auto-detected by your bbCode Manager, so that's all I have to do.
 
Wow, looks like I figured it out on my own after you gave me the hint. :)
Let me show you ... and correct me please, if I'm wrong.

I created a new PHP file inside /library/KingK/BbCodeManager/BbCode/Formatter/
This new file (say lbx.php) contains the following (dummy code):

Code:
<?php

class KingK_BbCodeManager_BbCode_Formatter_lbx
// unique class name (see lbx at the end)
{
	public static function parseTagTraining(array $tag, array $rendererStates, &$parentClass)
	{
		$src = $tag['children'][0];
		return 'this is my html code with the tag child #0 appearing here: ' . $src . ' and here: ' . $src;
	}

}

?>

And this file and the class inside are auto-detected by your bbCode Manager, so that's all I have to do.
Speaking from the development point of view, this is a bad way to accomplish this. Place this in a file called "MyBbCode.php":
PHP:
class MyBbCode
{
public static function parseTagTraining(array $tag, array $rendererStates, &$parentClass)
{
$src = $tag['children'][0];
return 'blah';
}
}

And switch it to call MyBbCode::parseTagTraining.
 
That would be assTagTraining for any American readers ;)

a mod should censor the wordings above
biggrin.png
 
Gee thanks XenStaff. :D
Wow, looks like I figured it out on my own after you gave me the hint. :)
Let me show you ... and correct me please, if I'm wrong.

I created a new PHP file inside /library/KingK/BbCodeManager/BbCode/Formatter/
This new file (say lbx.php) contains the following (dummy code):

Code:
<?php

class KingK_BbCodeManager_BbCode_Formatter_lbx
// unique class name (see lbx at the end)
{
	public static function parseTagTraining(array $tag, array $rendererStates, &$parentClass)
	{
		$src = $tag['children'][0];
		return 'this is my html code with the tag child #0 appearing here: ' . $src . ' and here: ' . $src;
	}

}

?>

And this file and the class inside are auto-detected by your bbCode Manager, so that's all I have to do.

If you take it out of the KingK folder, you won't worry about overwriting it.
 
I lef it as default, I haven't made any changes to it. But when I use your code the message got messed up:

ZaMvV.png

I haven't messed with this in awhile. Try editing your float bbc. Then remove the: "<div style="clear:both"></div>" in the simple replacement end. Mine looks like so:

Simple Replacement Start: <div style="float: %s;">
Simple Replacement End: </div>

From there add margin as you see fit. Perhaps <div style="float: %s; margin: 7px;">
 
I haven't messed with this in awhile. Try editing your float bbc. Then remove the: "<div style="clear:both"></div>" in the simple replacement end. Mine looks like so:

Simple Replacement Start: <div style="float: %s;">
Simple Replacement End: </div>

From there add margin as you see fit. Perhaps <div style="float: %s; margin: 7px;">

I've tried some variations but this didn't do any good either unfortunately. Thank you though.
 
Are you looking at it in the default style? I don't know what to tell you. Can you post a link to a page with an example, so I can have a look?
 
hello king i created my custom bbcode using this code


PHP:
public static function parseTagDown(array $tag, array $rendererStates, &$parentClass)
 {

$content = $parentClass->renderSubTree($tag['children'], $rendererStates);

$adsense= '<script type="text/javascript"><!--
google_ad_client = "pub-7333699328110653";
/* 468x60, date de création 01/01/09 */
google_ad_slot = "9561263875";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>';


return '<center><div class="bbcodedown"><div class="title">t&eacute;l&eacute;charger</div><div class="img"></div><br><span>'. $adsense .'<br>'. $content .'</span></div></center>';

 }

this work fine but when i try to edit a post via inline editor then i click save it show me a blank page so i must refresh the page manually to see the change but when i remove the adsense code it work fine , i ask if there is a solution to disable the parsing of this bbcode when i save the post or any other solution ??
 
I do not believe you can stop a code being parsed, as once I define them, I pass everything onto XF.
 
Status
Not open for further replies.
Back
Top Bottom