21301 Posts in 5736 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 909 Views |
-
SS3 DataExtension + Data Object

6 July 2012 at 3:04am
Hi,
I have problem.
Generally I want in one place add pictures to the sliders and they are to be displayed on all pages.
In SS 2.4.7 I add to SiteConfig
In SS3 I would do the same so:I try add to DataExtension DataObject
AllSite.php
class AllSite extends DataExtension {
static $has_many = array (
'Sliders' => 'Slider'
);
public function updateCMSFields(FieldList $fields) {
//SLIDER
$gridFieldConfigSlider = GridFieldConfig::create()->addComponents(
new GridFieldToolbarHeader(''),
new GridFieldAddNewButton('toolbar-header-right'),
new GridFieldDataColumns(),
new GridFieldEditButton(),
new GridFieldDeleteAction(''),
new GridFieldDetailForm()
);
$gridFieldSlider = new GridField('Sliders', 'Slider', new DataList('Slider'), $gridFieldConfigSlider);
$fields->addFieldToTab('Root.Slider', $gridFieldSlider);}
}class Slider extends DataObject
{
static $db = array ();
static $has_one = array (
'Slider' => 'Image',);
function getCMSFields() {
return new FieldSet(
new UploadField('Slider')
);
}
}in template i add:
<% loop SiteConfig %>
$Slider
<% end_loop %>inn backend i can add image to slider but in frontend in right place picture not show
Who have any idea?
Sorry for my bad English
-
Re: SS3 DataExtension + Data Object

6 July 2012 at 7:24am
Maybe something like:
<% with SiteConfig %>
<% loop $Sliders %>
$Slider
<% end_loop %>
<% end_with %> -
Re: SS3 DataExtension + Data Object

6 July 2012 at 8:00am Last edited: 6 July 2012 8:00am
thx for replay.
still nothing,
In you'r set i have errorp (you have to remove the $ in the control)
. I'm not sure if the code is correct, but even that everything looks good
If for example I will add to the database
static $ db = array (
'FooterContent' => 'htmlText'
);then <% control SiteConfig%> work but not in my example.
In last resort, write a function that collects in Page_Controller in someone side of these figures but I'd also know such a solution.
Sorry for my bad english
-
Re: SS3 DataExtension + Data Object

6 July 2012 at 8:15pm Last edited: 6 July 2012 8:15pm
Sorry about the &
Does your Slide object link back to SiteConfig, using something like:
static $has_one = array('SiteConfig' => 'SiteConfig');
i've not yet used the GridField from the SiteConfig, so I don't know if it works at all...
You could try a ?showqueries=1 to check if the query on Slides is actually executed and what it looks like...
| 909 Views | ||
|
Page:
1
|
Go to Top |

