10929 Posts in 2613 Topics by 1809 members
|Go to End|
31 December 2013 at 12:24am
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.
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
31 December 2013 at 11:48am Last edited: 31 December 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 http://doc.silverstripe.org/framework/en/reference/templates#conditional-logic for more information about conditional logic in the templates.
2 January 2014 at 12:06am
That's great! thank you heaps and Happy New Year!!
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.
3 January 2014 at 12:48am Last edited: 3 January 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...
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.
|Go to Top|