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

adding java script

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #11  
Old 11-05-2002, 02:25 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Can you add the javascript as an include and have the whole javscript as a separate file?

such as:
Code:
<script language="JavaScript1.2" src="myjavascript.js"></script>

Funkydunk
__________________
ex x-cart guru
Reply With Quote
  #12  
Old 11-05-2002, 02:35 AM
  seaCOAST's Avatar 
seaCOAST seaCOAST is offline
 

X-Adept
  
Join Date: Oct 2002
Location: New Hampshire
Posts: 569
 

Default

Quote:
Originally Posted by funkydunk
Can you add the javascript as an include and have the whole javscript as a separate file?

such as:
Code:
<script language="JavaScript1.2" src="myjavascript.js"></script>

Funkydunk

The script I paste into my html's looks like this:

Code:
<SCRIPT LANGUAGE="JavaScript"> <!-- Hide from old browsers function newscreen4() { window.open("","talk","width=300,height=350,resizable=no,scrollbars=auto") } // Stop hiding from old browsers --> Stamp = new Date(); year = Stamp.getYear(); document.write('http://www.theirsite.com/include/operator/icon.php?clientid=3627&'+Stamp+''); </SCRIPT>

I tried pasting it directly into the poweredby.tpl and the smarty errors came.
__________________
Xcart V4.5.5 Gold
seaCOAST
"Live FREE or DIE!"
Reply With Quote
  #13  
Old 11-05-2002, 02:53 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Try this:

Code:
{literal} <SCRIPT LANGUAGE="JavaScript"> <!-- Hide from old browsers function newscreen4() { window.open("","talk","width=300,height=350,resizable=no,scrollbars=auto") } // Stop hiding from old browsers --> Stamp = new Date(); year = Stamp.getYear(); document.write('[img]http://www.theirsite.com/include/operator/icon.php?clientid=3627&'+Stamp+'[/img]'); </SCRIPT> {/literal}
__________________
ex x-cart guru
Reply With Quote
  #14  
Old 11-05-2002, 03:05 AM
  seaCOAST's Avatar 
seaCOAST seaCOAST is offline
 

X-Adept
  
Join Date: Oct 2002
Location: New Hampshire
Posts: 569
 

Default

WOOHOO!

It worked!


THANK YOU FUNKY


What is the {literal} for?
__________________
Xcart V4.5.5 Gold
seaCOAST
"Live FREE or DIE!"
Reply With Quote
  #15  
Old 11-05-2002, 03:09 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

It just tells smarty to keep its mitts off the code and show exactly what is written. The problem is in the { brackets which smarty then tries to substitue code/variables etc.

Great to be of help.

Funkydunk
__________________
ex x-cart guru
Reply With Quote
  #16  
Old 11-05-2002, 04:46 AM
 
chris chris is offline
 

Senior Member
  
Join Date: Sep 2002
Location: UK
Posts: 145
 

Default ArmyNavy - adding javascript within a tpl

I think other have gone off at a tangent

all you have to do is add the line:
{literal}
at the beginning of your javascript
and finish off with
{/literal}

what this does is tell smarty to ignore everything inside the brackets - i.e to read it (javascript) literally,

Chris
__________________
Chris
some carts at v4.4.5 security patched on a hardened managed unix server
Reply With Quote
  #17  
Old 11-05-2002, 04:58 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

absolutely.

__________________
ex x-cart guru
Reply With Quote
  #18  
Old 11-05-2002, 03:21 PM
 
syddos syddos is offline
 

eXpert
  
Join Date: Sep 2002
Location: London, England, UK
Posts: 259
 

Default

seaCost, ArmyNavy,

you can mix smarty and javascript together using the {literal} {/literal} tags describe by Ian.

Here is an example; Ignore the lines begining with "//alert", they are just for variable debuging.

Quote:
{literal}
<SCRIPT language=javascript1.2>
<!--

framePath.jsFirstname={/literal}"{$userinfo.firstname}"{literal}
//alert('jsFirstname = '+framePath.jsFirstname );

framePath.jsLastname={/literal}"{$userinfo.lastname}"{literal}
//alert('jsLastname = '+framePath.jsLastname );

framePath.jsCurrentarea={/literal}"{$current_area}"{literal}
//alert('jsCurrentarea = '+framePath.jsCurrentarea );

framePath.jsMinicart_t_items={/literal}"{$minicart_total_items}"{literal}
//alert('jsMinicart_t_items = '+framePath.jsMinicart_t_items );

framePath.jsCurrency_symbol={/literal}"{$config.General.currency_symbol}"{litera l}
//alert('jsCurrency_symbol = '+framePath.jsCurrency_symbol );

framePath.jsMinicart_t_cost={/literal}"{$minicart_total_cost}"{literal}
//alert('jsMinicart_t_cost = '+framePath.jsMinicart_t_cost );
//-->
</script>
{/literal}


Regards,
__________________
Syddos

Nothing is impossible, We just don't know how to do it ........Yet!

Xcart 4.1.X PRO (Testing Platform: winXP Pro)
Perl 5.8.7 (win32)
WINAMP 1.6.3 (win32 server package. Includes the following)
- phpMyAdmin v2.8.03
- MySql 5.0.21
- Apache 2.0.55 (win32)
- php 5.1.4
- SQLitemanager 1.2.0
Reply With Quote
  #19  
Old 11-05-2002, 08:18 PM
 
ArmyNavy ArmyNavy is offline
 

Member
  
Join Date: Oct 2002
Location: Philadelphia, PA, USA
Posts: 28
 

Default

Many thanks, Syddos. As soon as I saw that "literal" thing, I knew that's what we were looking for. More Smarty stuff...

__________________
ArmyNavy.com TM
Military Surplus, Clothing, Gear, Vehicles, and Tons More.
\"Tons and Tons of Surplus!\" TM
Reply With Quote
  #20  
Old 12-12-2002, 12:25 PM
 
aostuff aostuff is offline
 

Member
  
Join Date: Oct 2002
Location: Atlanta, GA, USA
Posts: 22
 

Default

I've been using PHPLiveSupport from http://www.phplivesupport.com/ on my site for quite some time for the chat functionality. Very, very easy to integrate, and I get a ton of customers online using it. I forget the fee, but the software is like $100 one-time-fee, so it's not hosted, and you don't pay a recurring fee.

If you'd like to see a live example, you can visit my site at www.aostuff.com.

Take care,

Nick
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 01:41 AM.

   

 
X-Cart forums © 2001-2020