If anybody could help, it'd be much appreciated. I'm trying to query for content that would be edited in the CMS of Silverstripe, but not within my page.ss I want the content that is edited to display in accordance with a day function code that I wrote. That way someone can edit the content specifically for every monday weekly, tuesday, wednesday- and so forth. I'm currently having trouble cause I'm not sure what to call. But, this is my code for it.
For example:
<?php
/**
* Defines the HomePage page type
*/
class HomePage extends Page {
static $db = array(
'HSun' => 'HTMLText',
'HMon' => 'HTMLText'
);
static $has_one =array(
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root', new TabSet('Daily'));
$fields->addFieldToTab('Root.Daily.Sunday', new HTMLEditorField('HSun', 'Sunday Service'));
$fields->addFieldToTab('Root.Daily.Monday', new HTMlEditorField('HMon', 'Monday Service'));
return $fields;
}
}
class HomePage_Controller extends Page_Controller {
function days() {
date_default_timezone_set("America/Los_Angeles");
$sunday = '0';
$monday = '1';
$tueday = '2';
$wednesday = '3';
$thursday = '4';
$friday = '5';
$saturday = '6';
$today = date("w");
$CT = "Current Time: ".date("G:i");
$wed = DB::get($HSun);
//return "$today";
return $wed;
}
}
If anybody knows how to query it correctly, that'd be great, because that doesn't work at all, and I can't seem to figure it out...