Sure,
The user enters information as they would in this forum, to preserve new lines I call the nl2br() function however in the html template there is an image enclosed in a table, if you have the following that is created by nl2br():
article text<BR />
article text<BR /><TABLE><tr><td><img src=someimg></td></tr></table>
article text<BR />
etc<BR />
you end up with an image in between two paragraphs:
texttexttext //array element 1
texttexttext //array element 2
image
image
image
texttexttext //array element 3
etc
So I call explode on the <BR /> tags to put the text into an array. I spit out the first two elements of that array into pre-placed <P> tags and then loop through the rest of the array echoing out as <P>$array[$i]</P> the end result is:
texttexttext //array element 1
text image //array element 2 & single image
text image
text image
texttexttext //array element 3
etc
Essentially making a practical replacement for the ALIGN property in IMG tags. Now, before ppl start saying "why didn't you just do it on \n or \r instead of doing both nl2br and explode" the reason is that it didn't handle multiple vs single new lines properly - it would skip some lines for some reason... I'm assuming because of some lines having \n and others \n\r
As for preg_match you're thinking something like:
preg_match_all("/^[\[LIST\]]+*+[\[\/LIST\]]", $article_array[$i], $lists, PREG_SET_ORDER)){
for($i=0;$i<$lists;$i++){
$html .= '<LI>'.$lists[$i].'</LI>';
}
echo $html;
something like that? I have never used preg_match (and avoid regex at all costs... I'm really bad at them lol, I'm sure the one above is all wrong). If that is right how do yo get it back into the correct spot in the article to be spit out (since it would be called prior to nl2br())?
JMJimmy