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

Passing users screen resolution through as a variable

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-01-2006, 03:02 PM
 
weckie weckie is offline
 

eXpert
  
Join Date: Feb 2005
Location: Netherlands
Posts: 220
 

Default Passing users screen resolution through as a variable

I need users screen width as a variable in an tpl file.

FI. {if $var eq "1024"}Do This{else}DO THAT{/if}


Can this be done?
__________________
Herman Steijn

Using: X-cart 4.5.4
AT: http://www.weckonline.com LIVE
Reply With Quote
  #2  
Old 08-02-2006, 03:24 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

JavaScript is your best bet:

http://www.pageresource.com/jscript/jscreen.htm
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 08-02-2006, 04:33 AM
 
weckie weckie is offline
 

eXpert
  
Join Date: Feb 2005
Location: Netherlands
Posts: 220
 

Default

hi balinor,

I know, but how do it pass the javascript var through to smarty (as a smarty var)
__________________
Herman Steijn

Using: X-cart 4.5.4
AT: http://www.weckonline.com LIVE
Reply With Quote
  #4  
Old 08-09-2006, 02:57 PM
 
lachild lachild is offline
 

Advanced Member
  
Join Date: May 2006
Posts: 92
 

Default

According to the documentation you should be able to pass this to the script...

Code:
<SCRIPT language="JavaScript"> <!-- if ((screen.width>=1024) && (screen.height>=768)) { window.location="home.php?res=high"; } else { window.location="lowres.html?res=low"; } //--> </SCRIPT>

Then what I would do is right above this line in home.php

Code:
# # Assign Smarty variables and show template # $smarty->assign("main","catalog");

I might write something like this:

Code:
$res = $_GET['res']; $smarty->assign("res", $res);

Then you should be able to use...

{if $res eq 'high'}
Some Code Here
{else}
Some More code Here
{/if}
__________________
Westin Shafer
Come Together Technologies
http://www.ComeTogetherTechnologies.com
Reply With Quote
  #5  
Old 08-10-2006, 01:35 AM
 
weckie weckie is offline
 

eXpert
  
Join Date: Feb 2005
Location: Netherlands
Posts: 220
 

Default

thanks,

i will try it later today....
__________________
Herman Steijn

Using: X-cart 4.5.4
AT: http://www.weckonline.com LIVE
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 10:44 PM.

   

 
X-Cart forums © 2001-2020