Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Zepto in Front End Issues

Go to End

4 Posts   705 Views


Community Member, 545 Posts

16 July 2013 at 1:43am

I'm having trouble getting zepto.js to work in the front end on SS3.1. The Javascript console keeps throwing an End of File or Unexpected token. The standard zepto code snippet works on a plain HTML but not on the template. I'm wondering if it has something to do with tempalte processor.

Here is the snippet for refrence:

document.write('<script src=' + ('__proto__' in {} ? '$ThemeDir/javascripts/zurbvendor/zepto' : '$ThemeDir/javascripts/zurbvendor/jquery') + '.js><\/script>');

Guy Van Bael

Community Member, 61 Posts

18 July 2013 at 7:37pm


Judging from your code, i assume you've used the foundation framework from Zurb.
I ran into the same problem and solved it (how strange it might sound) by getting jquery.js and zepto.js out of the vendor folder and putting it in de javascripts folder (and - of course - changing the path in the template).


Community Member, 545 Posts

19 July 2013 at 12:45am

That's because foundation puts those directory in a directory called vendor and the standrd htaccess file for silverstrip restricts folders named vendor. My problem is whne teh stadard call gets password through the template processor it seems to read the </script> in the document.write asn the actual close for the script

But like I said it doesn't happen in plain html


Community Member, 187 Posts

19 July 2013 at 4:12am

Complete guess as I have no idea what's causing it, but I'd try wrapping it in CDATA tags:



If that doesn't work, perhaps put the snippet in a template and do