Jump to:

23368 Posts in 18143 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » $content.FirstParagraph can't handle &

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

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

Page: 1
Go to End
Author Topic: 941 Views
  • gmfallon
    Avatar
    Community Member
    2 Posts

    $content.FirstParagraph can't handle & Link to this post

    I'm trying to switch themes from blackcandy to natureweb4 and by doing so I get an error message when $content.FirstParagraph encounters an & -

    error on line 86 at column 32: xmlParseEntityRef: no name

    I searched the archives and found http://silverstripe.org/archive/show/2146 but the page referenced seemed to be addressing a different problem. Anyway, once I remove the "&" the error goes away.

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: $content.FirstParagraph can't handle & Link to this post

    This is because your template is an XML rather than HTML one. You can change this my removing the <?xml ?> line at the start of templates/Page.ss.

    Alternatively, $Content.FirstParagraph.XML may escape the & properly, though it may also escape things you don't want escaped, like brackets on tags.

  • gmfallon
    Avatar
    Community Member
    2 Posts

    Re: $content.FirstParagraph can't handle &amp; Link to this post

    Excellent - thanks Simon! Removing <?xml ?> fixed it.

    941 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.