Can't get Javascript to run in an included file

Having trouble installing serendipity?
Post Reply
jjohnstn
Regular
Posts: 6
Joined: Thu Nov 24, 2005 12:35 am

Can't get Javascript to run in an included file

Post by jjohnstn »

I'm using tags to pull in a PHP file in the entries.tpl file, like this:

<div class="serendipity_entry_extended"><a id="extended"></a>{$adpanel}{$entry.extended}</div>

(note {$adpanel})

The HTML in the PHP file is being included, but for some reason the Javascript is not working:

<script language="Javascript">
<!--
$refurl = document.referrer;
document.write('<IFRAME SRC="http://www.domain.com/foo/tracker.php?'+$refurl+'" WIDTH=1 HEIGHT=1 FRAMEBORDER=0></IFRAME>');
//-->
</script>

It appears in the outputed source code, but does not run.

Is there something I'm missing here?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Can't get Javascript to run in an included file

Post by garvinhicking »

Hm, it shouldn'T be a problem to run JS code there. But you are using "$refurl" for your javascript. JS does not allow variable names with $ I think.

What's your URL, where can one see it? Check it with Firefox and the JS Console open.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Post by Guest »

I removed the "$" from $refurl and... it worked! Odd, since I used the "$" in other places the same snippet of code is used, just not included in Serendipity, and it works there.

Many, many thanks :D
Post Reply