In a nutshell i am using the str_replace command to take entries from a mysql database and replace the placeholders in a rtf file. I am having problems removing some empty lines (\par in rtf markup). For formatting reasons i need to remove them.
here is an example of the rtf markup in the file:
\\ul\b Job_Title2\b0 - Employer2 ExpCity2, ExpState2 ExpStart2 \endash ExpEnd2\par
\ulnone\bullet j2_skill1\par
\bullet j2_skill2\par
\bullet j2_skill3\par
\bullet j2_skill4\par
\bullet j2_skill5\par
\bullet j2_skill6\par
\par
here is an example of the corresponding code in the php script:
if($edu_name2 == "")
{
$output = str_replace("\ul\b edu_name2\b0 - edu_city2, edu_state2\par", "", $output) ;
$output = str_replace("\ulnone edu_degree2, edu_start2 - edu_end2\par", "", $output) ;
$output = str_replace("Major: edu_major2\par", "", $output) ;
}
else
{
$output = str_replace("edu_name2", $edu_name2, $output) ;
$output = str_replace("edu_start2", $edu_start2, $output) ;
$output = str_replace("edu_end2", $edu_end2, $output) ;
$output = str_replace("edu_degree2", $edu_degree2, $output) ;
$output = str_replace("edu_major2", $edu_major2, $output) ;
}
If you look in the rtf code the /par at the bottom is what i need to replace if there is no entry("")
I hope this makes sense to someone. Any help is appreciated. Let me know if i need to explain better.