Last active
December 16, 2015 07:08
-
-
Save chillu/5396571 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class WidgetArea extends DataObject { | |
static $belongs_many_many = array( | |
'Pages' => 'Page' | |
); | |
static $many_many_extraFields = array( | |
'Pages' => array( | |
'SectionName' => 'Varchar' | |
) | |
); | |
} | |
class Page extends SiteTree { | |
static $many_many = array( | |
'WidgetAreas' => 'WidgetArea' | |
); | |
} | |
class TextWidget extends Widget { | |
static $db = array( | |
'Content' => 'Text', | |
); | |
} | |
class AdWidget extends Widget { | |
static $db = array( | |
'Content' => 'Text', | |
'Height' => 'Int' | |
); | |
} | |
class ImageWidget extends Widget { | |
static $has_one = array( | |
'Image' => 'Image', | |
); | |
} | |
Page.ss | |
$Content | |
<% WidgetArea('sidebar') %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment