PDA

View Full Version : What is wrong with my plugin?


SnickersTK
01-21-2006, 07:38 PM
Hook Location = Newpost_preview

$bbcode_pattern = '/\\[mod=(\\d+)\\]/';
$bbcode_replacement = '<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center">
<tr>
<td><span class="smallfont"><strong>Moderator Warning:</strong></span></td>
</tr>
<tr>
<td class="modscode"><img align="left" src="http://www.[Censored].com/UH/BBcodes/images/mod.gif">$1</td><tr></table> ';
if(preg_match($bbcode_pattern, $previewmessage))
{
$previewmessage = preg_replace($bbcode_pattern, $bbcode_replacement ,$previewmessage);
}

If I write: [mod=test] and press preview, it just writes the exact same :(

oh this is the css I added:

.modscode{font-family: Courier, Courier New, Verdana, Arial;
color: #465584;
background-color: #FAFCFE;
border: 1px dotted #000;
padding: 2px;
width:98%;
margin: 0px auto 0px auto;
/*overflow: auto;
height: 200px;*/}

it doesn't do the code... unless I write numbers (Ex: 1,2,3,4)

Ok, how to make d+ into [a-z,A-Z,0-9] and still having the code working ( $bbcode_pattern = '/\\[mod=(\\d+)\\]/'; )

and should I do anything about $1 ?

and if I didn't make it clear... I need to be able to write alot. Ex: [mod=look at me I am typing]

Thanks!

SnickersTK
01-31-2006, 02:57 PM
any help?

amykhar
01-31-2006, 03:46 PM
I think d+ should be w+ You'll need to consult a regular expressions reference to make sure.