Forum Moderators: coopster
so then i thought, why dont i create a cgi script or include a php script within my html docs that will get the url from my root domain (www.example.co.uk), add '/text/' to it and then write. this means, when the client is on the client page, currently at www.example.co.uk/clients/index.html and they click text only, this means the cgi/php script will add '/text/' into the url so we get www.example.co.uk/TEXT/clients/index.html.
what an idea! but one big problem, i dont have the foggiest about perl and cgi and just learing the basics of php! is there anyone who can help me?ive had a go at messing around with perl but i havnt succeeded! its not as 'experimental' as html and javascript!
please help! or atleast teach me! cheers! :D
[edited by: jatar_k at 5:19 pm (utc) on June 12, 2004]
[edit reason] generalized [/edit]
all of your pages could contain an dynamic path and only include and link to the text pages instead of the regular pages.
Another thought is to have?type=text or some such var tacked onto the url if they select text only
then have some intelligence in your main template to alter base paths or not include images. It really depends on a lot of different things and is difficult to guess at the best approach for you.
I keep thinking also that you may need some way to make sure that spiders can't get at both versions of the page so there are no duplicate content problems.
I have a text viewer script (php) that intercepts .txt requests and presents a cool formatted version instead, there's a link to a plain text version on that page too, or the user could (I guess) make the extension .text and also get the raw version (the php script just passes it through in this case) something like..
# this is the text viewer handler thingie..
RewriteEngine on
RewriteRule (.*)\.t(.*)xt /inc/textview.php?txtfile=/public/docs/$1.t$2xt [NC]
it should be possible to work it out from that.
full source code for the text viewer available onsite!
;o)
(or
First, it looks simply like your original link is incorrect, I mean, why doesn't the link itself have "/TEXT/" in it? then reuests would go straight into /TEXT/, not the homepage.
If, for some reason, that's not possible, you can get mod_rewrite to add the "/TEXT/" part for you. This goes in your .htaccess file, which is in the root of your site, probably..
RewriteEngine On
RewriteRule ^clients/(.*)/clients/text/$1 [NC]
(I haven't tested that!) but anyway, now you are sending clients to another html page! I thought the user was looking for a text version? Why not send them directly to a text version, instead of another index?
It would be easy enough to have php generate a correct link for you, so a page like..
http://www.example.co.uk/clients/somepage.html
http://www.example.co.uk/text/clients/somepage.txt
I don't understand the problem with the original link. Could you explain why it's not possible to just put the correct link on the original html page in the first place? Or is it?
;o)
(or
[example.co.uk...]
and you decide that you want to see the text version of the site. Where i had a link, 'text only', that would point to:
[example.co.uk...]
the text version homepage! so the person would have to navigate to the clients page:
[example.co.uk...]
BUT!
i have kinda found a solution to this problem, but only works one way!
I have made a javascript that will rite:
<script language="JavaScript" type="text/javascript">
document.write('<a href=/text');
document.write(location.pathname);
document.write(' title=The TEXT VERSION accesskey=h>Text Only</a>');
</script>
this means that it will rite a link to /text and the the root path, in this case clients/myf.html
so with this location.pathname, that can be done.
but, is there a way of going backwards? as in, is that a js command where i can alter that, or will i have to use that mod rewrite thing?
also, a prob with js is that some people will have it off, which is a prob cos they want to view the site with no js or anythin! can cgi/php/wotever/ help me over come this?
thanks for all your help! ill make u lot a free website if u want! :D
[edited by: jatar_k at 11:18 pm (utc) on June 14, 2004]
[edit reason] generalized urls [/edit]