Cannot add html in head tag - I am trying to edit theme to embed gallery in my website

jinspin

Joined: 2005-08-26
Posts: 26
Posted: Wed, 2005-11-23 08:51

Hi

I am using latest 2.x stable version and followed the directions to edit the matrix theme.tpl in local folder and I add my html to it.
But I am getting following errors- it doesn't like anything I put inside the head tags. Also do I put my css file in local folder also?

I add this code right after the <head> and before {g->head}

<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}

and I get this error:

Fatal error: Smarty error: [in gallery:themes/matrix/templates/theme.tpl line 13]: syntax error: unrecognized tag: margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; (Smarty_Compiler.class.php, line 436) in /home/jinspin/public_html/gallery2/lib/smarty/Smarty.class.php on line 1088

Or I add some navbar javascript right after the <head>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

and I get this error:

Fatal error: Smarty error: [in gallery:themes/matrix/templates/theme.tpl line 15]: syntax error: unrecognized tag: //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i/home/jinspin/public_html/gallery2/lib/smarty/Smarty.class.php on line 1088

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Wed, 2005-11-23 09:40

Smarty considers the { and } curly brackets special characters. If you want to use those in your CSS or Javascript you should either:

* surround the entire block with {literal} .. {/literal}
* change each { to {ldelim} and each } to {rdelim}

 
Basje

Joined: 2005-11-23
Posts: 7
Posted: Thu, 2005-11-24 02:24

Or put the CSS in a seperate file and then import it using a link rel="" ... link in your page header. The same goes for your JavaScript.

Basje

 
jinspin

Joined: 2005-08-26
Posts: 26
Posted: Fri, 2005-11-25 17:09

Thanks for replies.
I was able to add the html code by blocking the code with {literal} .. {/literal}
Works great!
Happy Thanksgiving yall!