| 
	
 | 
 Posted by shaun.demellweek on 06/25/19 11:31 
Hi guys, would appreciate if someone could help me out. 
 
I'm working on a forum script, where a user's text is converted from 
code to html. 
 
I have made s start, and most functions are working. The problem I am 
having is this: 
 
If a user wants to put text into bold, they place it between 
[B]and[/B]. In the last sentence the word and would be in bold. That 
works fine. The problem I am having is if a user types it in twice for 
example: 
 
[B]I love[/B] php, it is [B]great[/B]! 
 
It is converting it to (in html): 
 
<b>I love[/B] php, it is [B]great</b>! 
 
How can I change my code to make it appear as 
 
<b>I love</b> php, it is <b>great</b>! 
 
The code I am using is: 
 
$itemtochange = 
ereg_replace("$from1(.*)$from2","$to1\\1$to2",$itemtochange); 
 
Any ideas? 
Many thanks in advance!
 
  
Navigation:
[Reply to this message] 
 |