Jump to:

23001 Posts in 11702 Topics by 2827 members

General Questions

SilverStripe Forums » General Questions » DataObject and absolute address for images

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

Page: 1
Go to End
Author Topic: 149 Views
  • Arbee
    Avatar
    Community Member
    17 Posts

    DataObject and absolute address for images Link to this post

    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!

    149 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.