Page 1 of 1
PHP generating text only version of pages
Posted: Thu Mar 03, 2005 9:45 am
by horsleyaa
Hi,
Can PHP generate text only versions of pages?
Posted: Thu Mar 03, 2005 9:52 am
by pickle
I'm not sure what you mean. If you want it to dump a webpage with nothing but text, yes it can, you just output text. If you want it to generate a txt file with the contents of a webpage, it can do that to, but differently.
I'm a little confused as to what you mean because this seems like a really simple question. Do you have anything to elaborate on?
Posted: Thu Mar 03, 2005 9:55 am
by horsleyaa
I am developing a website that is going to benefit from being accessible.
What I need is for PHP to generate a text only version of a page, and then generate links at the bottom of the page to other text only versions. So basically, what I need is PHP to read a file and strip out anything that is not text and then display the text, with links at the bottom of the page to other pages that are also in this text-only format
Posted: Thu Mar 03, 2005 10:07 am
by Chris Corbyn
You mean turn images off and everything... so the data transfer is reduced between client-server?
I don't think there's an actual function to do it, I'd PREFERABBLY wirte new text-only pages and just use them instead since the layout will go all funny if you just take the images out (Unless you carefully place a block div around each image).
Otherwise if you really want to strip out all images then you'd just run a preg_replace() with the appropriate regexp in it.
something like
Code: Select all
preg_replace('/<img src\=".+?">/', '', $page);
Posted: Thu Mar 03, 2005 10:11 am
by horsleyaa
thanks I was going to originally do this.
Can you look at the PHP and Accessibility post please?
Posted: Thu Mar 03, 2005 10:14 am
by feyd
a templating system is still the way to go for this..