Jump to content

Recommended Posts

Posted

In an actual project I had to install PW in a subdomain and display the content via JSON  / Pages Web Service.

So I have the problem that, when adding images to a CKEditor textarea, the image path has to be absolute. 

Is there a possibility to make CKEditor render the image path in that way?

Posted

As I found no solution without hacking the core I tried to do it with jQuery. This seemed to work, but then I recognized that the browser will have already tried to load the images from the relative path before the script will be called.

So I am using a PHP solution now:

$body_orig = $page->body;
$body_absolutepath = str_replace("/site/assets/files/", "http://xyz.de/site/assets/files/", $body_orig);
echo $body_abosultepath;

This works fine - but if somebody knows a simpler and better solution, please let me know.

Posted

Only thing that comes to my mind is that you could create a text formatter for that. It would do quite the same as your php example but you could easily append it to any textarea field you want and make changes at a single location

Posted

PHP string replacement is what I would do. I dont think that you really need an extra module for such a simple thing. I always try to avoid JS for output manipulation because its not cacheable and depends on that JS is activated by the user. So your solution seems to me as the best way for this purpose.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...