Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » using ampersand in nav label

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 2908 Views
  • Colin
    Avatar
    Community Member
    15 Posts

    using ampersand in nav label Link to this post

    I have noticed that if I use an ampersand in the Page name, even though the page title and the actual page filename are fine, I get an XML parsing error because it is not properly encoded as & in the navigation label field. It would be nice of the system caught this prior to publishing.

  • Andy
    Avatar
    230 Posts

    Re: using ampersand in nav label Link to this post

    You can solve this by replacing $Title with $Title.XML in your template.

  • Colin
    Avatar
    Community Member
    15 Posts

    Re: using ampersand in nav label Link to this post

    Andy: Thanks! Are there any other side effects or gotchas by doing this? If not, why is this not default?

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: using ampersand in nav label Link to this post

    Hmm, I thought $Title was supposed to render the raw text as XML safe text anyway? Perhaps this needs to be fixed?

    Sean

  • Colin
    Avatar
    Community Member
    15 Posts

    Re: using ampersand in nav label Link to this post

    Just to be clear, my issue is not with the Title or Page Name fields, but with the Navigation Label field. It is the unescaped ampersand in the nav unordered list that is causing the XML error.

    I have fixed it in my site by escaping it; however, it seems that the field should be made XML safe text by default.

    2908 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.