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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

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

I don't get it - two different types


Go to End


2 Posts   1399 Views

Avatar
wayne

Community Member, 14 Posts

24 July 2009 at 3:24am

Hi,

Ok I'm very new to SS, and I'm trying to pull ou site together. Now I have this issue I I just cannot seem to understand what I need to do.

So I have a page call 'Pricing' (I created a pricing.php and .ss)
Within this page I have two different types of content that we want to display.

ie layout somewhat like
<start page>
Pricing

Content1, Content1,Content1, Content1
Content2, Content2
<end page>

I've created a php and layout ss for each of these types, so that in the admin area we can create page for each one to populate that content.

I have got as far as Content1 but when I try and display content2 I don't know how to get these pages.

For Content1 I'm doing:


<% control Children %>
	<% if LessThanFive  %>
		<% include ContentBox %>
        <% end_if %>							
<% end_control %>

However I don't know how to display the other type. I've tried doing this:

<% control getContentBoxLargeHorz %>						
	<% include ContentBoxLargeHorz %>
<% end_control %>

class Pricing_Controller extends Page_Controller {
	
	function getContentBoxLargeHorz() {
		 $here = DataObject::get_one("Pricing"); 
  	return ($news) ? DataObject::get("ContentBoxLargeHorz", "$here->ID") : false;
	}

}

But this doesn't work.

How do I do this sort of thing?

Many thanks
Wayne

Avatar
wayne

Community Member, 14 Posts

27 July 2009 at 6:44pm

ah figured it out. I had a silly typo - seruprising what a weekend can do for having a fresh view at something

should of been:
function getContentBoxLargeHorz() {
$here = DataObject::get_one("Pricing");
return ($here) ? DataObject::get("ContentBoxLargeHorz", "") : false;
}