Jump to:

794 Posts in 409 Topics by 304 members

Widgets

SilverStripe Forums » Widgets » Customising RandomContent widget - show first paragraph only

Discuss SilverStripe Widgets.

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

Page: 1
Go to End
Author Topic: 785 Views
  • greenpea
    Avatar
    Community Member
    19 Posts

    Customising RandomContent widget - show first paragraph only Link to this post

    Hi, I made an change to the RandomContent widget so that it would show only the first paragraph of a page.

    The original code

    <div class="RandomContentWidget">
       <% control RandomContent %>
          $Content
       <% end_control %>
    </div>

    Updated to show only the first paragraph of each page

    <div class="RandomContentWidget">
       <% control RandomContent %>
       <p>$Content.FirstParagraph <a href="$Link" title="Read more on &quot;{$Title}&quot;">Read more &gt;&gt;</a></p>
       <% end_control %>
    </div>

    Is there a better way to do this (i.e. without using <p> tags)?

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