Hi Simon, thanks for the advice... I changed teh variable name do $Down, but it seemed the main problem was that $Down returns my value, but the browser won't recognise it unless it's next to the px, for exampple
style="top: $Down px" outputs... style="top: 250 px" which firefox renderes as style=""
The trick is getting silverstripe to output style="top: 250px" (without the space), but of course putting style="$Downpx" in the tempalte isn't going to work. Which brings me onto my next problem...
I have a contact(Contact.php) which has_many offices (Office.php)
I wrote a function to get the map location of each office, which is in my contact controller...
function officeLocation() {
$office = DataObject::get_by_id('Office', $This->ID);
$style = "left: " . $office->Left . "px; top: " . $office->Down . "px;";
return $style;
}
Which works when just added into the tempalte, but if I add it inside my <% control Offices %> tag (which is where it needs to be) it can't seem to call my funtion, and if I move the function into my Office.php it still doesnt work.
This is the setup I am looking to acheive...
<% control Offices %>
<div class="location" style="$officeLocation">
<div class="location-inner">
<div class="address-wrapper">
<div class="address">
$Address<br/>
T: $Tel<br/>
F: $Fax<br/>
M: $Mob<br/>
E: $Email<br/><br/>
Contact: $Person
</div>
</div>
<div class="house"></div>
</div>
</div>
<% end_control %>