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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Structured Content with TableField


Reply


4 Posts   914 Views

Avatar
mkdigital

Community Member, 3 Posts

22 July 2009 at 2:26am

hi!

i'm currently working on a project where most pages have the same structure: a title and some sections. each section has html content, a category and an image.

i dont want to edit the content of these pages with HtmlEditorField, because if an user doesnt stick to the rules the generated html markup by HtmlEditorField wont work with my css.

i decidet to map a section to a dataObject like this:

class Section extends DataObject {
   public static $has_one = array(
      'ColPage' => 'ColPage',
      'Image' => 'Image'
   );
static $db = array(
"Content" => "Text",
"Category" => "Enum('Teaser, Normal')"
);
}

and use DataObjectManager for editing in the cms, which works fine, except that it is quiet annoying that every time i want to edit a section a lightbox pops up, and i cant add an image until i saved the Section, closed it and opened it again.

i tried to do this with TableField (which doesnt have popups but inline editing), but i couldnt get it to work with images (i read somewhere it doesnt work with htmlEditorFields nor ImageFields).

so.. what should i do? stick with the annoying popup of DataObjectManager or use HtmlEditorField which may produce weird markup.

maybe there is a better approach for working with heavily structured pages like that?

thanks in advance

Avatar
Martijn

Community Member, 271 Posts

22 July 2009 at 5:07am

Can't you just create a extendend pageclass and add more fields to that pagetype?

Avatar
mkdigital

Community Member, 3 Posts

22 July 2009 at 8:40pm

no, because i dont want the number of fields to be predefined.

another possible solution i thought of would be to customize htmlEditor (TinyMCE) in a way so it keeps the structure, but i dont know yet how to do this per Page.

Avatar
mkdigital

Community Member, 3 Posts

27 July 2009 at 9:18pm

noone got an idea?

it don't think it is uncommon to structure your content?

help pls!