Gossamer Forum
Home : Products : Links 2.0 : Customization :

javascript & templates

Quote Reply
javascript & templates
Hi,
I'm using the yahoo mod & trying to impliment the following javascript in my header.
The header is setup in templates.cfg

Here is the code i'm trying to run on home.html

For the variable:

$site_header = '<script language="JavaScript" type="text/javascript" src="http://www.mydomain.com/adserver/adx.js"></script>
<script language="JavaScript" type="text/javascript">
<!--
if (!document.phpAds_used) document.phpAds_used = ',';
phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);

document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
document.write ("http://www.mydomain.com/adserver/adjs.php?n=" + phpAds_random);
document.write ("&amp;what=zone:2");
document.write ("&amp;exclude=" + document.phpAds_used);
if (document.referrer)
document.write ("&amp;referer=" + escape(document.referrer));
document.write ("'><" + "/script>");
//-->
</script><noscript><a href=http://www.mydomain.com/...click.php?n=a45028c4 target="_blank"><img src=http://www.mydomain.com/...2&amp;n=a45028c4 border="0" alt=""></a></noscript>';


I assume the ' and ; in the above code is messing up the parser..
Any ideas on getting this working in my header?
Quote Reply
Re: [tightline] javascript & templates In reply to
Your JavaScript uses single quotes. You need to either escape them like \' or use a different quoting method, such as:
Code:
$site_header = q|
#your javascript here
|;

check the perlop manpage for further details on Quote and Quote-like Operators.

Philip
------------------
Limecat is not pleased.
Quote Reply
Re: [tightline] javascript & templates In reply to
Thank-you!

$= q| script stuff |

worked...