Customizing SMF > Mod Requests

Box Tag

(1/2) > >>

huijaa:
Hi,

I have a mod box-tag from YaBB SP1.3.1, here it is:-
--- Code: ---<id>
UBBC [box] tag SP1/1.1
</id>

<version>
1.2
</version>

<mod info>
This mod adds an extra [box] UBBC tag

Anything contained within the [box]...[/box] tags will appear in a box similar to the code box or quote box, but without any heading text, or additional formatting.

The width, background colour and alignment of the box can be changed by using [box width=???], [box color=???], [box align=???], [box color=??? width=???], [box align=??? color=???], [box width=??? align=???], [box width=??? color=??? align=???] or any other combination.
Width can be a number (pixels) or a percentage (%), color can be a name (white) or number (#FFFFFF) amd align can be "left", "right" or "center"
The style can be controlled by changing the style settings for .messagebox in the template

(Note: this uses the American spelling of color!)


To install: Apply the mod and upload the modified files - that's it!


Version 1.1 - bug fix: The boxes are now displayed on the printable thread display, but any align, width or color attributes are ignored.
Version 1.2 - bug fix: Empty boxes (nothing between the [box][/box] tags are now displayed correctly.
</mod info>

<author>
BHRA Webmaster
</author>

<homepage>
http://www.bhra.org.uk
</homepage>

<edit file>
english.lng
</edit file>

<search for>
$txt{'706'} = qq~<B>Code:</B><table bgcolor="$color{'bordercolor'}" class="bordercolor" cellspacing="1" width="90%"><tr><td><table cellpadding="2" cellspacing="0" class="code" width="100%"><tr><td><font face="Courier New" class="code" size="1">CODE</font></td></tr></table></td></tr></table>~;
</search for>

<add after>
$txt{'706a'} = qq~<table bgcolor="$color{'bordercolor'}" class="bordercolor" cellspacing="1" width="BOXWIDTH"BOXALIGN><tr><td><table cellpadding="2" cellspacing="0" width="100%" class="messagebox"BOXSTYLE><tr><td>BOXMESSAGE</td></tr></table></td></tr></table>~;
</add after>

<edit file>
template.html
</edit file>

<search for>
/* Post quote/code colors */
</search for>

<add after>
.messagebox   { color: #000000; background-color: #DEE7EF; }
</add after>

<edit file>
Sources/YaBBC.pl
</edit file>

<search for>
sub quotemsg {
</search for>

<add before>
sub box {
$parameter{'width'}  = "";
$parameter{'color'}  = "";
my ($tmpstuff, $tmpmessage) = @_;
foreach $dummy (split(/ /,$tmpstuff)) {
($key, $value) = split(/=/,$dummy);
$parameter{$key} = $value;
}

if ($parameter{'width'} eq "") {$parameter{'width'} = "90%";}
if ($parameter{'color'} ne "") {$parameter{'color'} = qq~ bgcolor="$parameter{'color'}" style="background-color:$parameter{'color'}"~;}
if ($parameter{'align'} ne "") {$parameter{'align'} = qq~ align="$parameter{'align'}"~;}

$_ = $txt{'706a'};
$_ =~ s~BOXWIDTH~$parameter{"width"}~ig;
$_ =~ s~BOXSTYLE~$parameter{'color'}~ig;
$_ =~ s~BOXALIGN~$parameter{'align'}~ig;
$_ =~ s~BOXMESSAGE~$tmpmessage~ig;
return $_;
}

</add before>

<search for>
$message =~ s~\[quote\s+author=(.*?)link=(.*?)\s+date=(.*?)\s*\]\n*(.*?)\n*\[/quote\]~&quotemsg($1,$2,$3,$4)~eisg;
</search for>

<add before>
$message =~ s~\[box+(.*?)\](.*?)\[\/box\]~&box($1,$2)~eisg;

</add before>

<edit file>
Sources/Printpage.pl
</edit file>

<search for>
$threadpost =~ s~\[quote\s+author=(.*?)link=(.*?)\s+date=(.*?)\s*\]\n*(.*?)\n*\[/quote\]~<BR><i>on $3, <a href=$scripturl?action=display;$2>$1 wrote</a>:</i><table bgcolor=#000000 cellspacing=1 width=90%><tr><td width=100%><table cellpadding=2 cellspacing=0 width=100% bgcolor=#FFFFFF><tr><td width=100%><font size=1 color=#000000>$4</font></td></tr></table></td></tr></table>~isg;
</search for>

<add before>
$threadpost =~ s~\[box+(.*?)\](.*?)\[\/box\]~<table bgcolor="#000000" cellspacing="1" width="90%"><tr><td width="100%"><table cellpadding="2" cellspacing="0" width="100%" bgcolor="#FFFFFF"><tr><td width="100%"><font face="Arial,Helvetica" size="1" color="#000000">$2</font></td></tr></table></td></tr></table>~isg;

</add before>

--- End code ---
and I'm searching for such mod for SMF 1.0. I hope you have it already...
It's because of lovely mod.

andyat11:
Can you please post an example

Jerry:
I thought the example was self explanatory ;)

basically this without Quote above it, and probably does not span but the words inside it ;) When the custom bbcode mod gets updated it would be easy to achieve huijaa.

--- Quote ---Hello
--- End quote ---

mytreo:
I need the very same mod (it is lovely!) and I spoke with Anguz about it just the other day. He said he will make it after he has finished updating his Faster Parsecode mod. :D :D

Webby:
something like this (Subs.php) :

add after


--- Code: ---'~\[acronym=((?:&quot;)?)(.+?)\\1\](.+?)\[/acronym\]~i' => isset($disabled['acronym']) ? '$3 ($2)' : '<acronym title="$2">$3</acronym>',
--- End code ---

the following code :


--- Code: ---'~\[box\](.+?)\[/box\]~i' => '<div style="margin: 1px; padding: 1px; background-color: #c0c0c0; color: black; border: 1px solid black;">$1</div>',
--- End code ---

?

Navigation

[0] Message Index

[#] Next page

Go to full version