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

Auto Resizing Help

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-06-2005, 08:49 AM
 
ronp ronp is offline
 

Advanced Member
  
Join Date: Feb 2003
Location: SE US
Posts: 30
 

Default Auto Resizing Help

I am looking for a simple way to automatically size according to customers screen resolution. I have pieced together several snipets of javascript code that looks like it should work to me but generates a runtime error Expected: ')'
For the life of me I can't find what is causing this error and I have tried everything I can think of. Any help would be much appreciated.

This is the part that is throwing the error (v 3.51)

skin1/customer/home.tpl

{literal}
<SCRIPT LANGUAGE="JavaScript">
if ((isset($HTTP_GET_VARS["ScrnSize"])) and (!x_session_is_registered("ScrnSize"))) {

var ScrnSize = "UnCommon"

if (navigator.appVersion.indexOf("4.") != -1 &&
navigator.appName.indexOf("Explorer") != -1) {
ScrnSize = screen.width + "x" + screen.height;
}
if (navigator.appVersion.indexOf("4.") != -1 &&
navigator.appName.indexOf("Netscape") != -1) {
ScrnSize = screen.width + "x" + (screen.height + 19);
}
switch(ScrnSize) {
case "800x600" : $ScrnSize = "800"; break;
case "1024x768" : $ScrnSize = "1024"; break;
default : $ScrnSize = "800";
x_session_register("ScrnSize");
$smarty->assign("ScrnSize",$ScrnSize);
}
}

</script>
{/literal}
__________________
----------------------------------------------------
X-Cart 3.5.1
\"Heavily Modified\"
Win2000 Advanced Server/Apache 2.0.54 w/OpenSSL 0.9.7g
PHP 4.4.0/MySQL 4.1.14-nt
Reply With Quote
  #2  
Old 09-08-2005, 06:11 AM
 
balinor balinor is offline
 

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

Default

I'd look for a completed JavaScript on hotscripts.com and try that, as your pieced together version has some code errors in it. I'm not a JavaScript expert, so I can't help, but that would be my suggestion.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 09-09-2005, 07:01 PM
 
ronp ronp is offline
 

Advanced Member
  
Join Date: Feb 2003
Location: SE US
Posts: 30
 

Default Javascript Errors

I finally got something to work but in a completely different way. I had never worked with javascript and am very green with php, but I eventually found out that you can't pass a variable directly from javascript to php, since js is client side and php is server side, so the php is actually parsed first and totally seperately from the javascript.
Anyway thanks for taking the time to reply.
__________________
----------------------------------------------------
X-Cart 3.5.1
\"Heavily Modified\"
Win2000 Advanced Server/Apache 2.0.54 w/OpenSSL 0.9.7g
PHP 4.4.0/MySQL 4.1.14-nt
Reply With Quote
  #4  
Old 09-09-2005, 09:27 PM
  Dongan's Avatar 
Dongan Dongan is offline
 

X-Wizard
  
Join Date: Jul 2005
Location: www.mercuryminds.com
Posts: 1,531
 

Default Re: Javascript Errors

Quote:
Originally Posted by ronp
I finally got something to work but in a completely different way. I had never worked with javascript and am very green with php, but I eventually found out that you can't pass a variable directly from javascript to php, since js is client side and php is server side, so the php is actually parsed first and totally seperately from the javascript.
Anyway thanks for taking the time to reply.

Can u share the solution ?
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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:52 PM.

   

 
X-Cart forums © 2001-2020