<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Forum posts to 'Site Builders'</title>
		<link>http://www.silverstripe.com/site-builders-forum/</link>
		

		
		<item>
			<title>Re: Issue with multiple has_one of same class on page</title>
			<link>http://www.silverstripe.com/site-builders-forum/show/61484?showPost=61933</link>
			<description>ok, serious. don't use Dataobjects for that, you will over complicate the situation.&lt;br /&gt;&lt;br /&gt;If the content boxes will just be replicated on another page, use the following.&lt;br /&gt;&lt;br /&gt;For example if you set the root of the content to be entered on the home page.&lt;br /&gt;&lt;br /&gt;&amp;lt;% control Page(home) %&amp;gt;&lt;br /&gt;    $Title&lt;br /&gt;    $Content&lt;br /&gt;    $Some-other-field&lt;br /&gt;&amp;lt;% end_control %&amp;gt;&lt;br /&gt;&lt;br /&gt;That will pull the data from the home page to any other template you put that within. You can use it multiple times for your different content boxes.&lt;br /&gt;&lt;br /&gt;&amp;lt;% control Page(home) %&amp;gt;&lt;br /&gt;    $Header&lt;br /&gt;&amp;lt;% end_control %&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;% control Page(home) %&amp;gt;&lt;br /&gt;    $Image&lt;br /&gt;&amp;lt;% end_control %&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;% control Page(home) %&amp;gt;&lt;br /&gt;    $Links&lt;br /&gt;&amp;lt;% end_control %&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br&gt;Posted to: Issue with multiple has_one of same class on page</description>
			<pubDate>Sat, 26 Apr 2008 10:56:53 +1200</pubDate>
			<author> </author>
			<guid>http://www.silverstripe.com/site-builders-forum/show/61484?showPost=61933</guid>
		</item>
		
		<item>
			<title>Re: Issue with multiple has_one of same class on page</title>
			<link>http://www.silverstripe.com/site-builders-forum/show/61484?showPost=61668</link>
			<description>Blackdog, the reason I'm using it is because many different pages of my site have the same content box.&lt;br /&gt;&lt;br /&gt;A content box will have something like this:&lt;br /&gt;&lt;br /&gt;---------------&lt;br /&gt;|&quot;Header Text&quot;|&lt;br /&gt;---------------&lt;br /&gt;|  Image        |&lt;br /&gt;---------------&lt;br /&gt;| &amp;gt; Link 1      |&lt;br /&gt;| &amp;gt; Link 2      |&lt;br /&gt;| &amp;gt; Link 3      |&lt;br /&gt;---------------&lt;br /&gt;&lt;br /&gt;So, the reason I'm using DataObject is because I wanted to allow the user to manage the 1...N links in each content box.&lt;br /&gt;&lt;br /&gt;I suppose the easier way is just to give them another HTML field where they can enter an unordered list.&lt;br /&gt;&lt;br /&gt;willr, thanks for the advice.  I'll take it to heart.   I was just trying to DRY my code. :)&lt;br /&gt;&lt;br /&gt;If anyone else has any suggestions, I'm all ears.&lt;br /&gt;&lt;br /&gt;-Andy&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br&gt;Posted to: Issue with multiple has_one of same class on page</description>
			<pubDate>Sat, 26 Apr 2008 02:27:18 +1200</pubDate>
			<author>Andy Sinesio</author>
			<guid>http://www.silverstripe.com/site-builders-forum/show/61484?showPost=61668</guid>
		</item>
		
		<item>
			<title>Re: Issue with multiple has_one of same class on page</title>
			<link>http://www.silverstripe.com/site-builders-forum/show/61484?showPost=61527</link>
			<description>If a page has 3 content boxes I usually just 'hardcode' all the fields on HomePage. Seems easier. Sure you do repeat yourself 3 times and it looks nasty but it works :P&lt;br&gt;&lt;br&gt;Posted to: Issue with multiple has_one of same class on page</description>
			<pubDate>Fri, 25 Apr 2008 19:31:41 +1200</pubDate>
			<author>Will Rossiter</author>
			<guid>http://www.silverstripe.com/site-builders-forum/show/61484?showPost=61527</guid>
		</item>
		
		<item>
			<title>Re: Issue with multiple has_one of same class on page</title>
			<link>http://www.silverstripe.com/site-builders-forum/show/61484?showPost=61514</link>
			<description>I can't see why you are using DataObject.&lt;br /&gt;&lt;br /&gt;Please explain what type of content you propose for each of those 3 &quot;content boxes&quot;.&lt;br&gt;&lt;br&gt;Posted to: Issue with multiple has_one of same class on page</description>
			<pubDate>Fri, 25 Apr 2008 18:39:26 +1200</pubDate>
			<author> </author>
			<guid>http://www.silverstripe.com/site-builders-forum/show/61484?showPost=61514</guid>
		</item>
		
		<item>
			<title>Issue with multiple has_one of same class on page</title>
			<link>http://www.silverstripe.com/site-builders-forum/show/61484</link>
			<description>So, I'm creating a site using SilverStripe, and I'm having some struggles trying to figure out the best way to accomplish a goal.&lt;br /&gt;&lt;br /&gt;The site I'm creating has a HomePage where there are three &quot;content boxes&quot; that have a header, an image, and some links below them.&lt;br /&gt;&lt;br /&gt;I am trying to allow my clients to manage the data that appears in each box.&lt;br /&gt;&lt;br /&gt;I have a ContentBox DataObject class that has a few data members.  I also have a HomePage class that has three instances of ContentBox, e.g.:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[i]class HomePage extends Page {&lt;br /&gt; &lt;br /&gt;   static $has_one = array(&lt;br /&gt;		'LeftContentBox' =&amp;gt; 'ContentBox',&lt;br /&gt;		'RightContentBox' =&amp;gt; 'ContentBox',&lt;br /&gt;		'BottomContentBox' =&amp;gt; 'ContentBox'&lt;br /&gt;   );	&lt;br /&gt;&lt;br /&gt;	function getCMSFields() {&lt;br /&gt;	    $fields = parent::getCMSFields();&lt;br /&gt;&lt;br /&gt;	&lt;br /&gt;		 // content boxes&lt;br /&gt;		$fields-&amp;gt;addFieldsToTab('Root.Content.LeftContentBox', LeftContentBox::getCMSFieldsToInclude());&lt;br /&gt;		$fields-&amp;gt;addFieldsToTab('Root.Content.RightContentBox', RightContentBox::getCMSFieldsToInclude());&lt;br /&gt;		$fields-&amp;gt;addFieldsToTab('Root.Content.BottomContentBox', BottomContentBox::getCMSFieldsToInclude());&lt;br /&gt;          return $fields;&lt;br /&gt;       }&lt;br /&gt;}[/i]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ContentBox has its own array() of fields:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[i]class ContentBox extends DataObject {&lt;br /&gt;...&lt;br /&gt; function getCMSFieldsToInclude() {&lt;br /&gt;&lt;br /&gt;	  $fields =  array(&lt;br /&gt;      	new TextField('HeaderText', 'Header Text'),&lt;br /&gt;        new TextField('HeaderLink', 'Header Link URL'),&lt;br /&gt;	  	new ImageField('Image')&lt;br /&gt;	  );&lt;br /&gt;	  return $fields;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;[/i]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;When I try and edit a HomePage in the CMS, I get the following error:&lt;br /&gt;&lt;br /&gt;[i]FATAL ERROR: collateDataFields() I noticed that a field called 'HeaderText' appears twice in your form: 'Form_EditForm'. One is a 'TextField' and the other is a 'TextField'&lt;br /&gt;At line 110 in /Applications/MAMP/htdocs/sapphire/forms/CompositeField.php[/i]&lt;br /&gt;&lt;br /&gt;------&lt;br /&gt;&lt;br /&gt;So, does anyone have any suggestions as to how I should design this?  Do I need to make three separate subclasses of ContentBox (left, bottom, right) that implement different named fields?&lt;br /&gt;&lt;br /&gt;Thanks in advance for any help you can provide.&lt;br /&gt;&lt;br /&gt;-Andy&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br&gt;&lt;br&gt;Posted to: Issue with multiple has_one of same class on page</description>
			<pubDate>Fri, 25 Apr 2008 16:42:22 +1200</pubDate>
			<author>Andy Sinesio</author>
			<guid>http://www.silverstripe.com/site-builders-forum/show/61484</guid>
		</item>
		

	</channel>
</rss>
