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

Using external Javascipts

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 05-17-2006, 06:38 PM
  shipmerchant's Avatar 
shipmerchant shipmerchant is offline
 

eXpert
  
Join Date: Mar 2005
Posts: 361
 

Default Using external Javascipts

Hi,

I need to use some external java script, I have created a /Scripts folder in my stores directory.
Created my external script and placed it in area outlined below.


Named it newscipt.js then uploaded to my newly created /scripts folder.

Then in my stores home.tpl I placed the following script to call the external java script like so:
{literal}<script language="Javascript"src="/scripts/newscript.js"type="text/javascript"></script>{/literal}

I know that any Java Scripts added to a template should be enclosed in {literal} and {/literal} but not sure where exactly to place it.
I have tried:

{literal}<script language="Javascript"src="/scripts/newscript.js"type="text/javascript"></script>
{/literal}

And even added it to the external script to no avail in both cases, like so.
{literal}<!--document.write("<script language="PlacedJavaScriptHere ")
//-->{/literal}

And tried this too:
<!--document.write({literal}"<script language="PlacedJavaScriptHere "{/literal})
//-->


Any help would be appreciated on this from you code experts.
Thanks in advance
__________________
Mil Mascaras
Live Xcart Site #1-V- 4.1.8
Live Xcart site # 2-V 4.4.3
CDSEO Mod - Firetank MM30 - 7DANA- The bestTemplates!
Linux - EWD Host Servers awesome service!
AlteredCart One Page Checkout
Reply With Quote
  #2  
Old 05-18-2006, 12:56 AM
  Zaja's Avatar 
Zaja Zaja is offline
 

X-Adept
  
Join Date: Mar 2004
Location: The Universe is my home
Posts: 420
 

Default

- Create scripts directory under skin directory.
- Call the external java script like this:
Code:
<script type="text/javascript" language="JavaScript 1.2" src="{$SkinDir}/scripts/newscript.js"></script>
- Example of newscript.js:
Code:
<!-- {literal} function printpage() { window.print(); } {/literal} // -->
__________________
_/ _/ _/ _/ _/ _/ _/ _/ _/

7dana.com
Reply With Quote
  #3  
Old 05-21-2006, 05:58 PM
  shipmerchant's Avatar 
shipmerchant shipmerchant is offline
 

eXpert
  
Join Date: Mar 2005
Posts: 361
 

Default

Quote:
Originally Posted by Zaja
- Create scripts directory under skin directory.
- Call the external java script like this:
Code:
<script type="text/javascript" language="JavaScript 1.2" src="{$SkinDir}/scripts/newscript.js"></script>
- Example of newscript.js:
Code:
<!-- {literal} function printpage() { window.print(); } {/literal} // -->

Sorry for the long delay in giving you my personal thanks for your suggestions. I tried them but still cannot get it to work.

I followed your instructions above or at least I think, unless I missed something?

created folder "skin1/scripts"

then added this code to my home.tpl

<script type="text/javascript" language="JavaScript 1.2" src="{$SkinDir}/scripts/scroll.js"></script>

Then created "scroll.js" and placed in the skin1/scripts folder, here my code below:

{literal} <script language="JavaScript" type="text/JavaScript">
<!-- Begin
var Message="scrollMessagetoappear";
var place=1;
function scrollIn() {
window.status=Message.substring(0, place);
if (place >= Message.length) {
place=1;
window.setTimeout("scrollOut()",100);
} else {
place++;
window.setTimeout("scrollIn()",120);
}
}
function scrollOut() {
window.status=Message.substring(place, Message.length);
if (place >= Message.length) {
place=1;
window.setTimeout("scrollIn()", 100);
} else {
place++;
window.setTimeout("scrollOut()", 100);
}
}
scrollIn()
// End -->
</script>{/literal}

But I still cannot get this too work, could you please assist me?

thanks in advance and sorry if I am missing something here.
__________________
Mil Mascaras
Live Xcart Site #1-V- 4.1.8
Live Xcart site # 2-V 4.4.3
CDSEO Mod - Firetank MM30 - 7DANA- The bestTemplates!
Linux - EWD Host Servers awesome service!
AlteredCart One Page Checkout
Reply With Quote
  #4  
Old 05-22-2006, 12:07 AM
  Zaja's Avatar 
Zaja Zaja is offline
 

X-Adept
  
Join Date: Mar 2004
Location: The Universe is my home
Posts: 420
 

Default

Shipmerchant, just folow simple instruction from my fist reply.....you don't need <script language="JavaScript" type="text/JavaScript">, </script>, Begin and End in scroll.js.

What result do you expect to get from this javascript code?
__________________
_/ _/ _/ _/ _/ _/ _/ _/ _/

7dana.com
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 04:49 AM.

   

 
X-Cart forums © 2001-2020