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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

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

Content block based interface


Go to End


2 Posts   2495 Views

Avatar
ianpiper

Community Member, 32 Posts

24 March 2009 at 10:04pm

Edited: 24/03/2009 10:05pm

I asked about building an interface based on content blocks a while back. The advice was useful and I am getting somewhere. However I have another question about structuring the application. I'm not sure whether it comes under templates or data models, so I am asking here.

I have put up the beginnings of the new site here: http://skeyn.com/

If you look at the home page here you will see a set of content blocks. Each of these is in effect the summary of a story that will appear in full on another page. I started by using Content.FirstParagraph to bring the content from the destination page into the content block, but this has a couple of drawbacks: it loses any text enhancement such as bold text, and I can't bring in images.

What I would like to do is have a definable section of text as a teaser on the front page, and a thumbnail image. Clicking the "read more" would take me to the full story with all of the text and a full-sized image.

The question is, should I have specific extra data fields in the full story to hold a teaser and thumbnail image, or is there a way to pick up just a section of the story to put on the front page (and ideally to put a thumbnail of the image there too)? I have looked at the tutorial where they are putting staff pictures up but can't see how to translate it to my need. I have also found a page in the documentation about the use of the HTMLText class but likewise can't quite see how to use it.

Hope this isn't too rambling and that someone can advise.

Thanks,

Ian.
--

Avatar
ianpiper

Community Member, 32 Posts

25 March 2009 at 3:00am

I think I have sorted it out now, though naturally I would still welcome any advice. Basically I have added two new fields to my ContentBlockPage class, to hold a teaser image and teaser text. Then I am picking those up in the ContentBlockHolder template. Seems to work well.