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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

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

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

Images


Go to End


2 Posts   1249 Views

Avatar
corkg

Community Member, 30 Posts

6 July 2008 at 12:16am

Edited: 06/07/2008 12:25am

Hi

At the moment I am adding images like this:

static $has_one = array(
'Image' => 'Image',
'ImageThumb' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new ImageField('Image'), 'Content');
$fields->addFieldToTab('Root.Content.Main', new ImageField('ImageThumb'), 'Content');

return $fields;
}
}

which is the way described in the tutorial: extending a basic site,

but i don't want the cms to make the image code (<img src="test.gif" alt="" />)i only want to see the link when i call for it (test.gif)

Avatar
dio5

Community Member, 501 Posts

6 July 2008 at 10:19am

instead of doing $Image in yr template, you can do

$Image.URL