Jump to:

3392 Posts in 976 Topics by 852 members

Template Questions

SilverStripe Forums » Template Questions » I don't get it - two different types

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

Page: 1
Go to End
Author Topic: 1019 Views
  • wayne
    Avatar
    Community Member
    14 Posts

    I don't get it - two different types Link to this post

    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

  • wayne
    Avatar
    Community Member
    14 Posts

    Re: I don't get it - two different types Link to this post

    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;
       }

    1019 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.