Jump to:

3435 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » Default Silverstripe shortcodes failing to parse

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

Page: 1
Go to End
Author Topic: 1246 Views
  • ezero
    Avatar
    Community Member
    7 Posts

    Default Silverstripe shortcodes failing to parse Link to this post

    In my search results (Page_results.ss) I have got $Content.FirstParagraph.RAW

    The problem is that I am seeing [[sitetree_link id=9]] on the results page, instead of the link. Is it some how failing to parse short codes? Or something I might have missed in the configuration?

    Could be a bug in Silverstripe but I have not attempted to replicate in another default install.

    Please advise.

    Thanks

    ---------------------------------------------------------------------------------------------------------------------------------

    Just to answer my question above (thanks to Willr)

    First thing I was doing wrong is use .RAW on the content which bypasses shortcodes.

    Secondly, he suggested alternative to use Summary(100) instead which still doesn't turn links in to links but atleast it doesn't show [[sitetree_link_id=9]] in the results

    Lastly, you can also write a custom function and stack on top of $Content.CustomFunction to get the desired effect.

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: Default Silverstripe shortcodes failing to parse Link to this post

    The code which I sent through (in case anyone else wants it) is available - http://pastie.org/1350494.

    For shortcodes to work the field must be a HTMLText field. Sadly all the Text functions don't return that type of object (hence the casting in that example)

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