Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: Text only

  1. #1
    Regular Coder
    Join Date
    Jul 2005
    Location
    Oxfordshire, UK
    Posts
    144
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Text only

    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.??

  • #2
    Regular Coder BonRouge's Avatar
    Join Date
    Mar 2006
    Location
    Sendai, Japan
    Posts
    328
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You do mean to convert one of your own pages to plain text, don't you? From the same server?

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

  • #3
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •