View Full Version : Text only

05-06-2006, 06:28 PM
Any ideas on where i can find a server side script either php or Perl/CGI that will convert any html page into text only for accessibilty.??

05-07-2006, 03:03 PM
You do mean to convert one of your own pages to plain text, don't you? From the same server?

This should do it...
$file = file_get_contents("filename.htm");
$text = preg_replace("/\<sty(.+?)\yle>/is", "", $file);
echo strip_tags($text);

(Just put the filename in).

05-07-2006, 04:38 PM
there's no reason to strip out the HTML, things like headings and paragraphs help to make pages make sense.
Just make sure that the pages you make don't rely on images, colour or bizarre positioning to make sense, and users should be able to browse the site how they prefer, whether that be with a 'regular' browser, a text-based one or a screen-reader.