Jump to:

23368 Posts in 18143 Topics by 2863 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: 184 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!

    184 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.