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, Ed, biapar, Willr, Ingo, swaiba

Place data from one set of pages on another

Go to End

3 Posts   714 Views


Community Member, 197 Posts

13 May 2009 at 8:31am

I want a template named to place ALL the values from ALL 'PortfolioIdentity' pages on it.

What should I put in and PreviewIndex.php to get all the data from PortfolioIdentity?


/// PortfolioIdentity.php
class PortfolioIdentity extends Page {

   static $db = array(

      'ItemTitle' => 'Text',
      'ItemSummary' => 'Text'

   static $has_one = array(

      'Icon' => 'Image'


   function getCMSFields() {

      $fields = parent::getCMSFields();

      $fields->addFieldToTab("Root.Content.PortfolioIndex", new ImageField('Icon','Item Icon'));

      $fields->addFieldToTab("Root.Content.PortfolioIndex", new TextField('ItemTitle','Item Title'));

      $fields->addFieldToTab("Root.Content.PortfolioIndex", new TextField('ItemSummary','Item Summary'));

      return $fields;



class PortfolioIdentity_Controller extends Page_Controller {



Carbon Crayon

Community Member, 598 Posts

13 May 2009 at 10:23pm

Edited: 13/05/2009 10:24pm

hi hknight

in your PreviewIndex_Controller class you want a function like this:

public function GetPortfolios(){

return DataObject::get("PortfolioIdentity");


Then in your you can do something like this:

<% control GetPortfolios %>
<% end_control %>

Hope that helps :)


Community Member, 197 Posts

14 May 2009 at 12:10am

Thanks aram, this is exactly what I needed, and it is so easy to implement!