X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Detect IE ... Can't seem to get this to work... (https://forum.x-cart.com/showthread.php?t=10103)

Ripbud 10-29-2004 08:37 PM

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

Ripbud 10-30-2004 11:49 AM

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

shan 10-31-2004 02:11 PM

have you tried the smarty forum, may get more smarty specific help there

Ripbud 10-31-2004 08:27 PM

Thanks.
 
I'll give that a wack.

Should I actually get something working I 'll be sure to post the solution.
-Ripbud


All times are GMT -8. The time now is 05:43 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.