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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

DataObject and absolute address for images


Go to End


530 Views

Avatar
Arbee

Community Member, 31 Posts

12 July 2013 at 5:32am

Hi, hoping someone can help me. I'm using 2.4.5 and trying to get htmleditor to insert absolute addresses for images. I used the following code which worked successfully in page.php

protected function onBeforeWrite() {
parent::onBeforeWrite();
$this->Content = str_replace(' src="assets/', ' src="http://mysite.com/assets/', $this->Content);
}

but I cannot make the same work for a dataobject. Is it possible? or is there some other way to do it?

Thanks!