PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Aug 13, 2004 5:39 am
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..
Lundern
Forum Newbie
Posts: 8 Joined: Fri Aug 13, 2004 2:24 am
Post
by Lundern » Fri Aug 13, 2004 5:59 am
Yes!!! Finally we got it to work
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