Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: MS Modders Team on September 18, 2010, 08:36:23 AM

Title: [Tip/Trick] IMG BBC - Border Parameter
Post by: MS Modders Team on September 18, 2010, 08:36:23 AM
This simply adds an optional parameter (border) to the [img][/img] tags so that you can have images with a border in posts.

It's a quick three edits, so lets get started!



First of all, lets add the parameter...

./Sources/Subs.php
The first of which, adds the actual parameter.
Code (Find) Select

'height' => array('optional' => true, 'value' => ' height="$1"', 'match' => '(\d+)'),

Code (Add After) Select

// SMF Modders; IMG BBC Border Parameter
'border' => array('optional' => true, 'value' => ' border="$1"', 'match' => '(\d+)'),

The second, adds the parameter to the tag, if specified.
Code (Find) Select

'content' => '<img src="$1" alt="{alt}"{width}{height} class="bbc_img resized" />',

Code (Replace) Select

'content' => '<img src="$1" alt="{alt}"{width}{height}{border} class="resized" />',





Now that we have the IMG BBC Border Parameter set up...we need to remove SMF's default border which is defined to 0px. Without this edit, the border parameter will have no effect.

./Themes/default/css/index.css
Code (Find) Select

.bbc_img
{
border: 0;
}

Code (Replace) Select

.bbc_img
{
/* border: 0; */
}


Please move this to the Tips and Tricks board if this is something useful.

As this is a quite small adaption, we are not going to submit it to the SMF Mod Site. However, for your ease of using this Tip/Trick we have attached a Package to complete these edits. Please note that the SMF Customization Team has not approved nor reviewed the attached package and the package comes without warranty for anyone who uses it.

Also note that this has only been tested and written directly for SMF 2.0 RC2 & RC3.

The SMF Modders Team
Title: Re: [Tip/Trick] IMG BBC - Border Parameter
Post by: MS Modders Team on October 18, 2010, 10:58:56 PM
Submitted as a mod: http://custom.simplemachines.org/mods/index.php?mod=2771

Also a bug was fixed in doing so.