I'm building an edit suite for a database-controlled site.
I have a situation where images and links are referenced from the root directory, eg 'userfiles/images/image_name.jpg' so my actual baseUrl needs to be '/userfiles/'. But the editor building the pages is within another area of the site, eg '/admin/' so for the editor to work it requires a baseUrl of '../userfiles/'.
I don't want to use an absolute address because the database needs to be transportable across different servers leaving me with the requirement to some-how have my links kept relative, saving using the root directory, but displaying in the editor using the admin path.
Is this possible?
I'm using CKEditor with CKFinder.
I have a situation where images and links are referenced from the root directory, eg 'userfiles/images/image_name.jpg' so my actual baseUrl needs to be '/userfiles/'. But the editor building the pages is within another area of the site, eg '/admin/' so for the editor to work it requires a baseUrl of '../userfiles/'.
I don't want to use an absolute address because the database needs to be transportable across different servers leaving me with the requirement to some-how have my links kept relative, saving using the root directory, but displaying in the editor using the admin path.
Is this possible?
I'm using CKEditor with CKFinder.
Re: Controlling Relative Paths across directories
I'm not sure how exactly do you want to have it configured, but someting like this should work in CKFinder as well:
Wiktor Walc
CTO, CKSource - http://cksource.com
--
Follow CKEditor on: Twitter | Facebook | Google+
Re: Controlling Relative Paths across directories
My site sort of looks like this:
So I'm editing content in 'admin/adminpage.php' that will be viewed in 'viewpage.php'.
If I set my $baseURL to '../userfiles/' then it works for the editor when it is nested within an 'admin' directory. So at this stage it looks fine and I'm seeing what I want to see.
But when I save the edited code, the images all have a URL like '../usefiles/imagefile.jpg'. When accessed from 'viewpage.php' it is trying to find a path that doesn't exist because this isn't nested like 'adminpage.php'.
If I change the $baseURL to 'userfiles/' then I can't see what I'm doing in the editor, but the images work when shown in 'viewpage.php'.
So how can I use the editor, seeing the correct imagery, yet save the images so they are relative from the root rather than from the editor?
I hope I'm making sense with this.
Re: Controlling Relative Paths across directories
$baseURL is given the relative path from the page doing the editing so new images show in the editor.
When loading html data from the database, the command would be something like:
and the relative path would then be appended to the image path.
When saving the data back to the database, the command would be:
and the relative path would be stripped from the image path.
Wish there was a way to handle this within CKEditor.