For example, I have news article in html page with images etc., i want to be able to only grab the text content of this news article to create a "printable" page of the news article. How can I do that?
You can try something like this:
// read the file contents into a variable // code to do that here // strip out html tags $text = strip_tags($file_contents); // if you're displaying this in a browser, you can use nl2br() to keep line breaks in-tact $text = nl2br($text); echo $text;
but i want to keep the text's html attributes/format such as table, fonts, http links etc. i only want to get rid off the non text contents such as images etc.
are there any codes do that?
thanks!