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.

General Questions /

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

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

DataObject and absolute address for images


Reply


264 Views

Avatar
Arbee

Community Member, 21 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!