17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1423 Views |
-
Extending member fields

17 June 2008 at 12:57am Last edited: 17 June 2008 12:58am
Hey There,
I managed to extend the members with an extra class (db table).
// define the db-fields
static $db = array('Adres' => 'Varchar',
'Postcode' => 'Varchar',
'Woonplaats' => 'Varchar',
'Telefoon' => 'Varchar',
'Mobiel' => 'Varchar',
'Geslacht' => 'Varchar',
'Geboortedatum' => 'Date'
);// Every profile has one member and one photo
static $has_one = array(
'Foto' => 'Image'
);
When i public view the profile i get all field by a $oMember = Member::get_by_id('Member',2);I also get a Field called FotoID. But how can i view that image?
I tried :
<% control Foto %>
Foto id = $ID
<% control CroppedImage(103,105) %>
<img id="profielImage"alt="<% control Member %>$FirstName $Surname<% end_control %>" title="<% control Member %>$FirstName $Surname<% end_control %>"src="$URL" />
<% end_control %>
<% end_control %>But it doesn't render the image.
Please help
Thanks!
-
Re: Extending member fields

17 June 2008 at 10:53am
This is a annoying little thing ive noticed but you get a ID returned so what you need to do is add another method to use that ID to get the photo and return the file.
so you would need a method like
function FotoFile() {
return ($this->FotoID) ? DataObject::get_by_id("File", $this->FotoID) : false;
}Then instead of using $Foto in the Template you would use $FotoFile for the Control.
| 1423 Views | ||
|
Page:
1
|
Go to Top |


