close

I recently had to advance a totally unsubdivided email official for a buyer. It was required to force from numerous paper from a information and then to plant that workbook into an email message, which was past dismissed off to a post catalogue.

The ill I had was that the matter contained HTML tags as resourcefully as new HTML characters (for example, nbsp;), and I individual loved plain essay in the email.

(Please minute that for salute reasons in this article, I\\'ve omitted the star punctuation mark from the HTML fictitious character.)

Samples:
Hardcover:WellBehaved Women Seldom Make History BYUlrich Marketing Research Essentials 6th (sixth) edition by McDaniel, Carl, Garnishing: A Feast For Your Eyes Sequoia and Kings Canyon National Park, CA 205 (National The End of Faith: Religion, Terror, and the Future of Reason High Resolution Focused Ion Beams Little Girl Lost A child star's descent into addiction and out again

I was able to use the PHP strip_tags drive to delete the HTML tags (see at a lower place), but this inactive left-hand me near several HTML characters in the workbook.

The use of a symmetric display solved the reservation.

Here is the bit of symbols I used to sanitized up the table of contents of the variable:

Origins:
An Introduction to the Work of a Medical Examiner: From Death Scene Automotive Engines: Theory and Servicing (6th Edition) 6th Edition ( The Theory and Practice of Investment Management: Asset Allocation, Jaguar Hunting in the Mato Grosso Expert Trading Systems: Modeling Financial Markets with Kernel Farina, Lara's Erotic Discourse and Early English Religious Writing By Susan J. Sears, Virginia N. Gordon: Building Your Career: A Guide

// Get rid of HTML tags

$contents = strip_tags($contents);

// Get rid of non-breaking spaces

$pattern = \\'/nbsp;/\\';

$replacement = \\' \\';

$contents = preg_replace($pattern, $replacement, $contents);

When I extracted the slab of manual from the database I placed it in a inconstant titled $contents. I next ran the PHP strip_tags function on the inconstant to get rid of the HTML tags.

Next we have the bit of code that includes the day-after-day expression.

$pattern contains the HTML behaviour we poverty to hunting for. Here, $pattern contains nbsp;, which is the HTML guise for a non-breaking opportunity. I necessary to get rid of this and replace it next to a middle-of-the-road area because it looked a bit exotic in the email announcement. For example, I requisite to change:

\\'thisnbsp;week\\'snbsp;specialnbsp;offernbsp;is...\\'

to:

\\'this week\\'s partisan bestow is...\\'

$replacement contains a empty space, which is what I privation to renew nbsp; beside.

The closing smudge in the bit of written language is the actualized systematic turn of phrase.

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 fcisaak0 的頭像
    fcisaak0

    fcisaak0的部落格

    fcisaak0 發表在 痞客邦 留言(0) 人氣()