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)
-   -   adding java script (https://forum.x-cart.com/showthread.php?t=526)

funkydunk 11-05-2002 02:25 AM

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

seaCOAST 11-05-2002 02:35 AM

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. :?

funkydunk 11-05-2002 02:53 AM

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}


seaCOAST 11-05-2002 03:05 AM

WOOHOO!

It worked! :D


THANK YOU FUNKY :!: :!:


What is the {literal} for?

funkydunk 11-05-2002 03:09 AM

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

chris 11-05-2002 04:46 AM

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

funkydunk 11-05-2002 04:58 AM

absolutely.

8)

syddos 11-05-2002 03:21 PM

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,

ArmyNavy 11-05-2002 08:18 PM

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

:) :)

aostuff 12-12-2002 12:25 PM

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


All times are GMT -8. The time now is 02:55 AM.

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