Thread Starter
zesty1
(@zesty1)
even if the if statement is wrong (which it might be, im new to php), even without the if, but always doing str_replace, it still doesnt work
Thread Starter
zesty1
(@zesty1)
I think im not using str_replace right or something…..
I also have this (which takes the input from a textarea) and is SUPPOSED to convert \r\n to
.
this is what i have in order in the php file
It actually doesnt do shite though…. it sends me the information with \r\n still in there.
store the value from previous form
$homecontent=mysql_real_escape_string($_POST['HomeContent']);
define function
function format_html($content)
{
$content = "<p>" . str_replace("\r\n", "<br />", $content) . "";
$content = "" . str_replace("<br /><br />", "</p><p>", $content) . "";
return "" . str_replace("<br /><li>", "<li>", $content) . "";
}
save the variable with the supposed changes
$homecontent = format_html("$homecontent</p>");
after that i insert it into a database and then php mail() it to mysef… and it always is full of \r\n
about your first post:
you don’t seem to have a string in your variable:
check the ‘echo’ parameter of ‘wp_list_pages’:
echo
(boolean) Toggles the display of the generated list of links or return the list as an HTML text string to be used in PHP. The default value is 1 (display the generated list items). Valid values:
1 (True) – default
0 (False)
http://codex.wordpress.org/Template_Tags/wp_list_pages
Thread Starter
zesty1
(@zesty1)
you are a rockstar. that worked 🙂
Thanks!
Do you have any idea on the 2nd issue? i assume its cause its an ‘ojbect’ or something.. and not a string. how can i convert a large block of text to a string?
your str_replace looks ok.
i just wonder if the </p>
in the following line is intentional:
$homecontent = format_html("$homecontent</p>");
and when you say, it is still full of \r\n
at the end, does this mean that the other formatting (<p>, </p>, etc
) is still mmissing ?
Thread Starter
zesty1
(@zesty1)
yes that is correct. it looks identical to the way it was stored as if the str replace didnt find anything
the p is to close the tag and is intentional due to the way the script writes. i didnt write it myself i just got it from the php manual comments that someone else wrote and everyone said worked great.
if you have any better ideas im all ears