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)
-   -   Rollover Tags? (https://forum.x-cart.com/showthread.php?t=4791)

Griswold 10-15-2003 12:58 PM

Rollover Tags?
 
I was trying to implement some javascript rollovers in my head.tpl file.
Everytime I do, it blows up the page. I used the {integral} tags around the rollovers themselves and it goes bam!
Any ideas?

shan 10-15-2003 02:36 PM

{integral} or {literal}

narisc 10-29-2003 05:32 PM

wait im lost do you need to put

the acutall code

{integral} in between the javascript coding or what?

moshguy 10-30-2003 08:46 AM

Suggestion
 
Create a separate TPL file for the javascript that goes in the head of the document. Name it something like javascript_header.tpl and include it customer/home.tpl. It worked great for me.

Second always use {literal}{/literal} tags around any Javascript functions. The reason is that JavaScript uses {} to declare functions. Smarty will interpret it as smarty and not JS. Which is one of the reasons why it keeps blowing up.

This is what your javascript_header.tpl should look like.

Code:

{literal}

<script language="JavaScript"">

function showStatusMsg(msgStr) 
{
    status=msgStr;
    document.BigValue = true;
}

</script>

{/literal}


This is what your customer/home.tpl should look like.

Code:

<html>
<head>
<title>My site</title>
{ include file="javascript_header.tpl" }
</head>


I do have a working example of JS image rollovers on my current X-Cart store.
http://www.angelcycleworld.com/cart/customer

NOTE: Don't try to use a JS file. For some reason IE doesn't like a JS file in smarty.

I sure hope this helps you guys out.

-Jeremy


All times are GMT -8. The time now is 04:56 AM.

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