Page 2 of 2

Posted: Fri Aug 13, 2004 5:39 am
by feyd
hmm, lets try the simpler approach:

Code: Select all

<?php

if(preg_match_all['#\['.'php](.*?)\[/'.'php]#is', $r['eksart'],$matches))
{
  foreach($matches[0] as $k => $str)
    $r['eksart'] = str_replace($str, '<b>PHP:</b><br><table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #FAFAFA; border: 1px solid #D1D7DC;">
  <tr>
    <td style="padding-left: 10px; padding-right: 10px; padding-top: 10px; padding-bottom: 10px;">' . highlight_string($matches[1][$k],true) .  '</td>
  </tr>
</table>');
}

?>
now, it kinda looks like we'll need a stripslashes in there, but not too sure..

Posted: Fri Aug 13, 2004 5:59 am
by Lundern
Yes!!! Finally we got it to work :D There was some bugs though:

Code: Select all

if(preg_match_all('#\['.'php](.*?)\[/'.'php]#is', $r['eksart'],$matches)) 
{ 
  foreach($matches[0] as $k => $str) 
    $r['eksart'] = str_replace($str, '<b>PHP:</b><br><table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #FAFAFA; border: 1px solid #D1D7DC;"> 
  <tr> 
    <td style="padding-left: 10px; padding-right: 10px; padding-top: 10px; padding-bottom: 10px;">' . highlight_string($matches[1][$k],true) .  '</td> 
  </tr> 
</table>', $str); 
}
Thanks alot dude ;) Your link is on our page :)

Posted: Sat Aug 14, 2004 5:02 pm
by timvw
If you were using PEAR:HTML_BBCode you could have used http://home.mysth.be/~timvw/programming ... source.txt