|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
hughprior Smarty Rookie
Joined: 07 May 2003 Posts: 10
|
Posted: Sat Nov 29, 2003 1:50 pm Post subject: Complex JavaScript causing Smarty to die |
|
|
I have a template which includes a complex JavaScript. When Smarty encounters the script, it dies as follows:
Fatal error: Smarty: [in index.tpl.htm line 18]: syntax error: unrecognized tag: doc.write(''); date_ob.setTime(date_ob.getTime()+43200000); doc.cookie='he=llo; path=/; expires='+ date_ob.toGMTString(); (Smarty_Compiler.class.php, line 417) in c:\Program Files\Apache Group\smarty\libs\Smarty_Compiler.class.php on line 2062
The script is as follows:
<script language="javascript"><!--
var doc=document; var url=escape(doc.location.href); var date_ob=new Date();
doc.cookie='h2=o; path=/;';var bust=date_ob.getSeconds();
if(doc.cookie.indexOf('e=llo') <= 0 && doc.cookie.indexOf('2=o') > 0){
doc.write('<scr'+'ipt language="javascript" src="http://media.fastclick.net');
doc.write('/w/pop.cgi?sid=9811&m=2&v=1.7e&u='+url+'&c='+bust+'"></scr'+'ipt>');
date_ob.setTime(date_ob.getTime()+43200000);
doc.cookie='he=llo; path=/; expires='+ date_ob.toGMTString();} // -->
</script>
So far I have tried:
a) Upgrading from Smarty 2.5 to Smarty 2.6 (I've aged several years in the process, considered turning back, but now 2.6 seems to work for me)
b) Seperating the offending script into it's own file and including it in the main template as follows:
{include file="fastclick_skyscraper.tpl"}
c) Including as a PHP file
{include_php file="fastclick_skyscraper.tpl"}
I am sure there must be an way to include the file without Smarty parsing it?
Thanks for any help.
regards,
Hugh
P.S. The site is http://www.localpin.com which has been gradually converted from using Ulf Wendel's IntegratedTemplate, to using Smarty. However, Ulf's code doesn't break on this JavaScript. A bug in Smarty perhaps? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|