Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

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

Teaser Content and security

Go to End

7 Posts   1193 Views


Community Member, 6 Posts

31 December 2013 at 12:24am

Hi Guys,

I would like to create content with two paragraphs, the first paragraph (short) will be a teaser with a "read more" linke. However, on click of read more i'd like to force the user to login in order to read the second bit of text. Does such already exist? if not, how would i go about it? i'm pretty new with SS.

Cheers :-)


Community Member, 400 Posts

31 December 2013 at 4:55am

You can easily add two HTMLText fields to the page (DataObject)

static $db = array(
"MoreContent" => "HTMLText"

this link will help.

and then use jQuery to slide up / slide down the more content on a toggle action


Forum Moderator, 267 Posts

31 December 2013 at 11:48am

Edited: 31/12/2013 11:49am

To allow only the second paragraph to be read when a Member is logged in you could wrap the paragraph in the SilverStripe template engine tags

<% if $CurrentMember %>
. . .

Paragraph goes here

. . .
<% else %>

You could add a message and link here to get the user to log in.

<% end_if %>

See for more information about conditional logic in the templates.


Community Member, 6 Posts

2 January 2014 at 12:06am

Hi Guys,

That's great! thank you heaps and Happy New Year!!


Community Member, 6 Posts

2 January 2014 at 10:53pm

Post New Years thoughts... and more questions :-)

Another question regarding secured content and also applicable to other content. Is it possible to use "shortcodes" to embed content from other pages onto an existing page? from the text editor as opposed to be programming something specifically?

I'm looking to replace a custom CMS with SilverStripe. The system in question allows users to add any type of content onto a page, including secured content with teaser text and alter the position on the page. All this is done from the page itself, just can't think of a way as yet with my limited knowledge of SS how I'd go about achieving the same result.



Forum Moderator, 1391 Posts

3 January 2014 at 12:48am

Edited: 03/01/2014 12:48am

Yes, you can use shortcodes in SilverStripe. In your HTML editor it might basically look something like:


Of course that wouldn't work out of the box, but he documentation will tell you the basics about how to write a a shortcode handler for it:

The handler would then retreive the first paragraph of the content of the page with id = 17...


Community Member, 6 Posts

2 July 2014 at 5:37pm

Cheers for that martimiz!

Hadn't seen your reply earlier... I'll be getting getting back to this soonish.