Page 1 of 1

[Solved]Character encoding error message

Posted: Sun Sep 22, 2013 1:20 am
by jasnick
Using 1.11.8 and modules up to date

A page is not loading correctly and I get the following error message:
The character encoding of the HTML document was not declared ....
In the template I have:

Code: Select all

           {process_pagedata}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-au">

<head>
	<title>{title}</title>
		
	{metadata}
	{cms_stylesheet}
<link rel="stylesheet" type="text/css" href="http://site.com.au/jquery.lightbox-0.5.css" media="screen" />
 <__script__ type="text/javascript" src="http://site.com.au/jquery.js"></__script>
<__script__ type="text/javascript" src="http://site.com.au/jquery.lightbox-0.5.js"></__script>	 
    <__script__ type="text/javascript">   
$(function() {
        $('#imagebox a').lightBox();
    });   
</__script>

</head> 
The page is not loading correctly (unstyled version and no images can be found according to Page Source) and when I check Tools/Errors, the above error message comes up.
The charset is in Global Metadata.
Thanks

Re: Character encoding error message

Posted: Sun Sep 22, 2013 9:47 am
by rotezecke
maybe unrelated but from smarty docs
{literal}{/literal} tags are normally not necessary, as Smarty ignores delimiters that are surrounded by whitespace. Be sure your javascript and CSS curly braces are surrounded by whitespace. This is new behavior to Smarty 3.
so your document ready function may need adjustment or {literal} tags.

Re: Character encoding error message

Posted: Sun Sep 22, 2013 11:56 am
by jasnick
Thanks rotezecke

Adding {literal}{/literal} did nothing. I am getting an error message:

ReferenceError: $ is not defined which I don't understand at all.

I used this exact same code in another site with no problems.

Re: Character encoding error message

Posted: Sun Sep 22, 2013 12:32 pm
by Jo Morg
I would test the links to the files as it seems that JQuery is not being loaded at all. Odds are that these are not correct:

Code: Select all

<link rel="stylesheet" type="text/css" href="http://site.com.au/jquery.lightbox-0.5.css" media="screen" />
 <__script__ type="text/javascript" src="http://site.com.au/jquery.js"></__script>
<__script__ type="text/javascript" src="http://site.com.au/jquery.lightbox-0.5.js"></__script>  
Do you really have these files on the root folder?

Re: Character encoding error message

Posted: Sun Sep 22, 2013 2:59 pm
by jasnick
Thanks Jo Morg - I agree

No, they are not in the root folder - I am assuming they are part of JQueryTools???

Before CMSMS I used to download the js files I needed and put them in a folder and call them from there. I've been trying to sort this out for the last 3 days and am getting very confused.

The thing is - I have the same code in a template in the test site where it works perfectly.
When the site went live, I copied all the files to the new site and for some reason it now won't work in the new site.

Re: Character encoding error message

Posted: Sun Sep 22, 2013 3:34 pm
by rotezecke
well you need to know where your JS lives on your server, or use google's CDN server AND make sure jQuery library is loaded before any plugin starts executing code. view source code and I bet you find that some fancy jquery plugin is called before the jqyery library.
all your JS should also run in

Code: Select all

$(document).ready(function () {
  //your JS
});
which will make sure jquery is ready when you it's needed.

Re: Character encoding error message

Posted: Wed Sep 25, 2013 6:01 am
by jasnick
rotezecke - I have discovered that Jquery was not the issue - the files being called were not listed correctly in the Products template - it was looking for photo1 and so on, instead of Photo1. Once that was corrected, the Jquery worked.

Thanks for your help. I've thanked Jo Morg in another thread.