How do I get the "$ShWidth" to display inside the control the first one outside is fine but not inside the control....
I want the width the same for every li the other info is variable etc.
I have this in my template:
SlideshowPage.ss
<ul>$ShWidth
<% control Slideshows %>
<li <% if First %>class="show"<% end_if %>><a href="http://$ShLink"><img src="$SlideshowImage.URL" width="$ShWidth" alt="$ShTitle" /></a></li>
<% end_control %>
</ul>
SlideshowPage.php
<?php
class SlideshowPage extends Page
{
static $db = array(
'ShWidth' => 'Int'
);
static $has_many = array (
'Slideshows' => 'Slideshow'
);
public function getCMSFields()
{
$f = parent::getCMSFields();
$f->addFieldToTab("Root.Content.SlideshowConfiguration", new NumericField('ShWidth','Slideshow Width (pixels)'));
$manager = new DataObjectManager(
$this, // Controller
'Slideshows', // Source name
'Slideshow', // Source class
array('ShTitle' => 'Title', 'ShLink' => 'Image Link', 'Thumbnail' => 'Image'), // Headings
'getCMSFields_forPopup' // Detail fields function or FieldSet
// Filter clause
// Sort clause
// Join clause
);
$f->addFieldToTab("Root.Content.Slideshow", $manager);
return $f;
}
}
class SlideshowPage_Controller extends Page_Controller
{
}
?>
Slideshow.php
<?php
class Slideshow extends DataObject
{
static $db = array (
'ShTitle' => 'Text',
'ShLink' => 'Text',
);
static $has_one = array (
'SlideshowImage' => 'Image',
'SlideshowPage' => 'SlideshowPage'
);
function Thumbnail() {
$Image = $this->SlideshowImage();
if ( $Image ) {
return $Image->CMSThumbnail();
} else {
return null;
}
}
public function getCMSFields_forPopup()
{
return new FieldSet(
new ImageField('SlideshowImage','Slideshow Image'),
new TextField('ShTitle','Title'),
new TextField('ShLink','Image Link')
);
}
}
?>
Thanks!