Quantcast
Channel:
Viewing all articles
Browse latest Browse all 4235

More template woes

$
0
0

Hi,

My stuggle with even the most basic of concepts goes on, I find it painfully frustrating that a couple of weeks into using SS I am still having issues with templates. If anyone can shine any light on this issue I would appreciate it:

WhatsonHolder.php:

<?php

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class WhatsonsHolder extends Page {

private static $allowed_children = array(
'Whatson'
);
      
}

class WhatsonsHolder_Controller extends Page_Controller {
   
}

?>

WhatsOn.php

<?php

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class Whatson extends Page {

private static $has_many = array(
'Shows' => 'Show'
);

function getInfo() {
return $this->renderWith("Shows");
}

public function getCMSFields() {
// Get the fields from the parent implementation
$fields = parent::getCMSFields();
// Create a default configuration for the new GridField, allowing record editing
$config = GridFieldConfig_RelationEditor::create();
// Set the names and data for our gridfield columns
$config->getComponentByType('GridFieldDataColumns')->setDisplayFields(array(
'Name' => 'Name',
'Whatson.Title'=> 'Whatson' // Retrieve from a has-one relationship
));
// Create a gridfield to hold the show relationship
$showsField = new GridField(
'Shows', // Field name
'Show', // Field title
$this->Shows(), // List of all related shows
$config
);
// Create a tab named "Shows" and add our field to it
$fields->addFieldToTab('Root.Shows', $showsField);
return $fields;
}

}

class Whatson_Controller extends Page_Controller {

}
?>

Show.php

<?php

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
class Show extends DataObject {

private static $db = array(
'ID' => 'Int',
'Name' => 'Varchar',
);

private static $has_one = array(
'Whatson' => 'Whatson'
);

function getInfo() {
return $this->renderWith('Show');
}

}
?>

Shows.ss

Hello we are here!

No matter what I do, rebuild. flush I cannot get the Shows.ss file to read, it's in the layout folder!

What am I doing wrong?


Posted to: More template woes | Show Thread | Post Reply


Viewing all articles
Browse latest Browse all 4235

Trending Articles