3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 352 Views |
-
Set image width in SiteConfig

17 October 2011 at 7:47am
I tried to control templates main image width by customizing SiteConfig and added there data field for number. Now I'd like to read this number in template like this:
<div class="MainImage">$MainImage.SetWidth($SiteConfig.MainImageMaxWidth)</div>
But, that does not seem to work. My CustomSiteConfig goes like this:
<?php
class CustomSiteConfig extends DataObjectDecorator {
function extraStatics() {
return array(
'db' => array(
'MainImageMaxWidth' => 'Int',
)
);
}public function updateCMSFields(FieldSet &$fields) {
$fields->addFieldToTab("Root.Main", new TextField('MainImageMaxWidth', _t('SiteConfig.MAXMAINIMAGEWIDTH','Set maximum width for main image in template')));
}
}What I did wrong?
-
Re: Set image width in SiteConfig

18 October 2011 at 4:15am
I found another post from forum: http://www.silverstripe.org/template-questions/show/11731
I think I have a same kind of problem: can not use variables...
-
Re: Set image width in SiteConfig

18 October 2011 at 4:57am
And this is my stock answer to using a variable as a param...
http://www.silverstripe.org/template-questions/show/13619#post290481
| 352 Views | ||
|
Page:
1
|
Go to Top |


