Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Images, Templates and alt attributes

Go to End

2 Posts   2059 Views


Community Member, 6 Posts

16 January 2008 at 3:55am

I need the alt attribute of my image to be the title of the page it is being viewed on. any ideas?

class StaffPage extends Page{
static $has_one = array(
'Photo' => 'Image'
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Images", new ImageField('Photo'));
return $fields;


Community Member, 19 Posts

16 January 2008 at 4:26am

Check out the Image API
There are a lot of different methods that you can use but I think this should be a good solution:

<img src="$Photo.getFullPath" alt="$Title"/>