Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » $Content without first.paragraph

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: 3736 Views
  • snaip
    Community Member
    180 Posts

    $Content without first.paragraph Link to this post

    How to display text without first paragraph ?

  • SalvaStripe
    Community Member
    89 Posts

    Re: $Content without first.paragraph Link to this post

    Hmm.. you want to show your $Content without First Paragraph?

    This is for showing only First Paragraph: $Content.FirstParagraph
    This is for showing for example the first 25 Word: $Content.LimitWordCount(25)

    Showing $Content without First Paragraph you can do 2 Methods...
    First Method is to create a new "PageType".. maybe called "ArticlePage"

    Then add the First Paragraph Text into the ArticlePage.ss before the $Content tag. When you use now $Content oder $Content.FirstParagraph in your ArticleHolder.. what uses <% control children %> or thing like this.. you will get the Content without the first Paragraph!!!

    The second method is well coded. You must create again a new PageType. In the php-File of this new PageType you can add a new field like $Content2 oder $FP (first paragraph)..
    so you have 2 different TextAreas in your CMS.. this way is easier to handle with your content, but little more to write in your php file.

    if you dont know how to add a second Content field for your PageType and how to use it, write here and i'll answer!


  • UncleCheese
    4085 Posts

    Re: $Content without first.paragraph Link to this post

    function AllButFirstParagraph() {
    return str_replace($this->obj('Content')->FirstParagraph(), '', $this->Content);

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.