Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: noIE popup
its only a single line after the if conditional. you don’t need any braces.
Offline
Offline
#18 2008-01-27 12:55:01
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: noIE popup
Thanks all! How would the code be if I wanted to distinguish between IE7 and IE6 or less? And should I also use PHP in the head instead of <!--[if lte IE 6]><![endif]--> to link to the style sheets?
Last edited by els (2008-01-27 13:29:08)
Offline
Re: noIE popup
And should I also use PHP in the head instead of <!—[if lte IE 6]><![endif]—> to link to the style sheets?
You can use those for stylesheets. It’s stylesheet not hidden content :)
Thanks all! How would the code be if I wanted to distinguish between IE7 and IE6 or less?
By adding there the version number after the MSIE.
Example value: MSIE 5.0, MSIE 5.5, MSIE 6.0 and MSIE 7.0
<txp:php>if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7.0') !== FALSE) echo 'You are using Internet Explorer.';</txp:php>
<txp:php>if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0') !== FALSE OR strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 5.0') !== FALSE) echo 'You are using Internet Explorer.';</txp:php>
Cheers!
Last edited by Gocom (2008-01-27 16:01:56)
Offline
#20 2008-01-27 16:05:54
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: noIE popup
Thank you very much Gocom! :)
And if I want to exclude IE, can I just use == instead of !== ?
Offline
Re: noIE popup
And if I want to exclude IE, can I just use instead of ! ?
Er, no – it’s just a conditional. If you change that to == then it output that conditional contest when browser is anything else than IE.
If you want completely exclude, meaning block IE, you could use die/exit. In example:
<txp:php>if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== FALSE) exit("Sorry Boris, you're using IE. No access to my site with your browser.");</txp:php>
Cheers!
Last edited by Gocom (2008-01-27 16:16:08)
Offline
#22 2008-01-27 16:49:38
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: noIE popup
Gocom wrote:
Er, no – it’s just a conditional. If you change that to
==then it output that conditional contest when browser is anything else than IE.
That’s what I meant :) Just hide some content that doesn’t work in IE6.
Offline