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.

Customising the CMS

Getting error "EntityRef"


Reply

8 Posts   7692 Views

Avatar
HitByLife

1 March 2009 at 12:41am (Last edited: 1 March 2009 12:43am), Community Member, 6 Posts

I have installed SS on a client site and I am in the process of implementing the design I have created for the site. I thought I had followed the SS conventions correctly, but it does not turn out right at the moment. I'm getting the following error with a broken design:

This page contains the following errors:

error on line 51 at column 11: EntityRef: expecting ';'
Below is a rendering of the page up to the first error.

I have checked my Page.ss files, but see nothing wrong.

Any help is much appreciated.

Avatar
HitByLife

3 March 2009 at 11:56pm Community Member, 6 Posts

Hm, looks as if it was caused by an error in the syntax; "&Layout" for "$Layout." It's just that I spotted it, fixed it, and it was still the same. So, I left it, and the day after, when going back to work on it, it worked. Strange.

Avatar
kuenkuen82

24 March 2010 at 7:11pm Community Member, 41 Posts

Where is the best place to start looking when seeing error message like:

<code>
error on line 74 at column 64: EntityRef: expecting ';'
</code>

Avatar
banal

24 March 2010 at 8:49pm Community Member, 901 Posts

It means you have a malformed entity in your (X)HTML. Example for entities: &quot; &amp; &laquo; etc.
It could be in your template (search .ss files), or maybe you have an ampersand in a Title field and you forgot to escape it? To correctly escape textfields like Title use: $Title.XML in your template (and $Title.ATT in attributes).

Avatar
kuenkuen82

25 March 2010 at 12:49am (Last edited: 25 March 2010 12:51am), Community Member, 41 Posts

There is still is a problem when viewing the page in any of the stage or when I flush the page. I think it's to do with the DataObjectSet

I get this problem with: http://doc.silverstripe.org/doku.php?id=private:recipes:pagination

Avatar
banal

25 March 2010 at 1:34am (Last edited: 25 March 2010 1:35am), Community Member, 901 Posts

If you get the problem when using pagination, there's most likely an error in the pagination template.
Just out of curiosity, do you have a <?xml version="1.0" encoding="UTF-8"?> header in your source code (Page.ss)? If yes, remove it.

Avatar
kuenkuen82

25 March 2010 at 3:22pm Community Member, 41 Posts

Yes it was and removing it solve the problem. Do you know why it was there in the first place?

Avatar
juliuy

8 February 2011 at 3:43am Community Member, 1 Post

I have a similar issue. I have a controller in ChartPage.php which has a method ShowChart() returning this value:

<img name="WebChartViewer" src="ChartDirector/phpdemo/getchart.php?img=chart1&id=591de62d3e3e0486f741c37bada0ae3b4d500333e0f33&" align="left" border="0" usemap="#WebChartMap"/>

In layout template ChartPage.ss I write $ShowChart to display that value. But I get that very same error you are talking here about.

I can write $ShowChart.XML, but then all my '<', '>' and other symbols are escaped. I am a newbie to SilverSprite, so I am kind of surprised that I can't return a string using controller's method if that string has some special symbols. What would be your advice about that?

Julius