Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Detect IE ... Can't seem to get this to work...

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-29-2004, 08:37 PM
 
Ripbud Ripbud is offline
 

Member
  
Join Date: Oct 2004
Posts: 17
 

Default Detect IE ... Can't seem to get this to work...

I'm trying to use a plugin I found for Smarty - but no matter what I do - I can't get it to work within an X-cart template:

Code:
<?php /** * Smarty plugin * @package Smarty * @subpackage plugins */ /** * Smarty {ie_detect} function plugin * * Type: function * Name: ie_detect * Date: 2.10.2004 * Purpose: Detect IE browser * Input: * * Example: * {ie_detect} * {if $ie} * <link rel="stylesheet" type="text/css" href="only-ie.css" /> * {else} * <link rel="stylesheet" type="text/css" href="not-ie.css" /> * {/if} * @link http://smartbee.sourceforge.net/ * @author Martin Konicek <martin_konicek@centrum.cz> * @version 1.0 * @param null * @param Smarty * @return boolen */ function smarty_function_ie_detect($params, &$smarty) { $ie = strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') ? true : false; $ie = strpos($_SERVER["HTTP_USER_AGENT"], 'Opera') ? false : $ie; if($ie){ $smarty->assign('ie', true); } else { $smarty->assign('ie', false); } } /* vim: set expandtab: */ ?>

This is the plugin code which I placed into function.detect_ie.php into the smarty plugin directory...

into the head template I placed:

Code:
{ie_detect} {if $ie} <link rel="stylesheet" type="text/css" href="only-ie.css" /> {else} <link rel="stylesheet" type="text/css" href="not-ie.css" /> {/if}


No matter how I tweak the code I can never get the $ie to return true or false... I know the plugin is being called - because I hardcoded

Just:

Code:
$smarty->assign('ie', "Is this working?");

And of course I was able to print it out on the template...

For some reason it's as though the $_SERVER["HTTP_USER_AGENT"] isn't functioning...

Can anyone give me code for a working IE detector?

Thank you so much!
-Ripbud
__________________
4.13
Reply With Quote
  #2  
Old 10-30-2004, 11:49 AM
 
Ripbud Ripbud is offline
 

Member
  
Join Date: Oct 2004
Posts: 17
 

Default Okay this is a wacky forum

I've never been on a forum where people don't respond to some extent within a day - even if they don't have an answer...

Am I asking in the wrong place or ... ?

Thanks
-Ripbud
__________________
4.13
Reply With Quote
  #3  
Old 10-31-2004, 02:11 PM
  shan's Avatar 
shan shan is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Birmingham, UK
Posts: 6,163
 

Default

have you tried the smarty forum, may get more smarty specific help there
__________________
Looking for a reliable X-cart host ?
You wont go wrong with either of these.

EWD Hosting
Hands On Hosting
Reply With Quote
  #4  
Old 10-31-2004, 08:27 PM
 
Ripbud Ripbud is offline
 

Member
  
Join Date: Oct 2004
Posts: 17
 

Default Thanks.

I'll give that a wack.

Should I actually get something working I 'll be sure to post the solution.
-Ripbud
__________________
4.13
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:36 PM.

   

 
X-Cart forums © 2001-2020