Posts: 89
Threads: 12
Joined: Feb 2012
Hi,
I don't know if there is a fix or not but the only way, I suppose, is to ask. I've searched the forum but havn't found any posts directly related to this issue or if there is a fix.
I've noticed that the path to any image or link to a PDF has the full path inserted eg http://mydomain/data/uploads/image.jpg and I can see why it's like this. I assume that when in admin the relative path would be different than the front end therefore the fix would be to insert the full path which would always be correct.
The problem I have (and I don't know if other people have this issue as well) but when developing websites I use a localserver (XAMPP in my case) and I design as much as possible locally for convenience and speed and so I don't need to upload to my server to see any change.
Of course as you have probably guessed - when my website is finished and the pages are uploaded to the server (I usually use a demo location first for the client to approve etc) the hard coded links are not changed and all images and PDF links are don't work because they are pointing to http://localhost/. . .
The solution I have is to find and replace text strings in the XML files so it points the correct spot on the web server. I then have to do this a second time when the site is moved the LIVE location.
I'm just wodering if other poeple have come accross this issue? If there is a workaround of sorts or (the best solution) if using some smart programing detect that a user is in ADMIN and therefore the path would different than if in the front end.
Any thoughts?
Posts: 2,928
Threads: 195
Joined: Feb 2011
yes,
many people have come across this issue and it was discussed already
it is also mentioned in the WIKI (but not very complete)
well, the absolute path is inserted by CKEditor and it might have some advantages (for example, if you move pages around in the hierarchy the links will still be ok)
there were some infos how to "update" the image links in the forum here
what I do is this:
all data is stored in the folders /data and it's subfolders
so you can run a search and replace with either a good editor and loading all these pages in the editor
or you run a global search and replace with a good filemanage (Windows: DirOpus for example)
by all means, the data files have to be updated
Posts: 89
Threads: 12
Joined: Feb 2012
Thanks Connie for repling and clarifying.
Doesn't seem to be anyway around it then. Not to worry. I won't wonder if there is a better way when performing the find and replacing next time
Posts: 2,928
Threads: 195
Joined: Feb 2011
I tried to find a working way to configure the CKEditor to use relative paths instead of absolute paths.
Until now I didn't find it, and I was distracted by other experiments...
but it is on my todo-list to find out ;=)
Posts: 89
Threads: 12
Joined: Feb 2012
Yes it's a tricky one because when in admin the relative path is different. Good luck and if it's anything like my TODo list then there is a lot on it.
Posts: 14
Threads: 0
Joined: Feb 2012
While I haven't looked into the CKEditor angle, in GS 3.0, putting only a forward slash in the "Website Base URL:" field on the Settings page works and everything then uses relative urls. I use much the same methodology as Stryker (local development, put on public server for client approvals, put on final server at end of project) and never have to do a find/replace on the paths.
I notice in my testing of GS 3.1, putting "/" in the "Website Base URL:" field comes back with an error.
Is it possible the issue isn't CKEditor?
Posts: 89
Threads: 12
Joined: Feb 2012
Thanks for replying Ed. When I place just the forward slash in the "Website Base URL" the whole website breaks and no graphics defined in the template and CSS are found. ie it can't find the CSS file.
The source code in CKEDITOR also still hard codes the whole URL to find the pic. Are you saying that when you insert an image in CKEDITOR and then go to the source code that you have a relative path? I wonder how it finds the image both in ADMIN and the front end?
Maybe you have other config options that makes this work?
Posts: 2,928
Threads: 195
Joined: Feb 2011
Ed at ISI Wrote:in GS 3.0, putting only a forward slash in the "Website Base URL:" field on the Settings page works and everything then uses relative urls this is only possible if your local GetSimple installation sits in the root of the local server
Guess, how many installations I have at my local server? 11 at this time ;=)
so this does not help
Posts: 14
Threads: 0
Joined: Feb 2012
stryker Wrote:Maybe you have other config options that makes this work?
I use MAMP Pro as a web server locally so every project has its own local domain (i.e. to Connie's point, all my projects are on their own root and I can run any number of projects simultaneously this way).
GS 3.1 seems to no longer support this scheme, though.
I am wondering if it's possible to use a variable as the domain name that gets hard coded and then change the variable's value when we change servers.
Posts: 3,491
Threads: 106
Joined: Mar 2010
Ed at ISI Wrote:While I haven't looked into the CKEditor angle, in GS 3.0, putting only a forward slash in the "Website Base URL:" field on the Settings page works and everything then uses relative urls. I use much the same methodology as Stryker (local development, put on public server for client approvals, put on final server at end of project) and never have to do a find/replace on the paths.
I notice in my testing of GS 3.1, putting "/" in the "Website Base URL:" field comes back with an error.
Very interesting method. I would only add one more step: setting the correct (full) URL when the project is finished, so that canonical URLs are complete.
To Make GS 3.1 work like 3.0 did, you just have to edit admin/settings.php, and in line 204 search for:
and change it to:
Posts: 89
Threads: 12
Joined: Feb 2012
Hi, I don't know if this helps but when I just edited a pages XML file directly and removed the "html://localhost/subdirectory-name/" from the full url image path so all that is left is "data/uploads/image.jpg", This works then on both localhost and the live domain in BOTH frontend AND Admin!!!
Ckeditor must use the root directly as the starting place for the loaction of the image - even in Admin.
This means all that has to be done is when an image is selected /inserted from CKEDITOR is to force the insertion URL to be "data/uploads/{image}" rather than the full http://{server/domain}/data/uploads/{image}.
Does anyone know where CKEDITOR gets the URL path info from? I had a look at the IMAGE plugin for CKEDITOR but I don't really know javascript that well but it may be in there somewhere.
Anyway thought I might add this two cents worth
Posts: 2,928
Threads: 195
Joined: Feb 2011
stryker Wrote:Does anyone know where CKEDITOR gets the URL path info from? I had a look at the IMAGE plugin for CKEDITOR but I don't really know javascript that well but it may be in there somewhere.
There are some links to that option for CKEDitor here in the forum insome posts, but I was not successfull to get it done
if you find some helpful info at ckeditor.net, please post it here
the forum there is nearly apathic, that's why I got no answer there once
Posts: 89
Threads: 12
Joined: Feb 2012
Hi Connie, I didn't realise there was a topic which covers this exact issue. I think I may have cracked it though and have put my findings there..
Here is a link to the origianal topic.
http://get-simple.info/forum/post/23856/#p23856
Posts: 51
Threads: 3
Joined: Jul 2013
2013-08-13, 02:54:53
(This post was last modified: 2013-08-13, 03:01:26 by Thomas Helzle.)
I'm relatively new to GS, so please bear with me if I miss something obvious.
I read many threads about this issue now and somehow it doesn't compute what the problem really is.
I only worked with Wordpress and ModX so far and never had this hurdle to get over with those.
- In all my templates I use "<?php get_theme_url(); ?>" or "<?php get_site_url(); ?>" to add the server path to my images etc, no problem there.
- I can't use the above in the Editor and the Browser always creates static absolute paths, so I came up with a slightly stupid workaround:
I installed the "DynPages" plugin, created a component "mainpath" with the content "<?php get_site_url(); ?>", so that I can now use {% mainpath %}data/uploads... for my images in the Editor.
- From the image paths I use with the "Custom Fields" plugin, I delete the server address by hand each time after I selected an image with the browser and add it back within my template.
After I move my pages to the server, it simply resolves to a different absolute path.
But while this allows me to move my files everywhere with all paths working, it not only feels silly, I can't see the images in the editor and I wouldn't want to bother customers with a workaround like this, that has to be edited in Source mode and you always have to remember to edit the paths by hand...
Maybe this whole topic isn't so much about relative paths as about dynamic paths? Using absolute paths solves the problem with child pages and I see no problem with using them, what I miss is a way to automagically replace all occurrences of the CURRENT server path with something like my {% mainpath %} variable above.
I'm no php wizard, but I wonder if it would make sense to introduce this kind of concept to GS?
I think a solution to this belongs into the core.
Especially in a CMS that makes the transfer of pages and content as easy as GS, it's irritating that this one piece of the puzzle is missing.
Or am I missing something?
That is another quite probable possibility ;-)
Thanks for everybody's contribution!
I'd love to have a simple solution for this - I want to leave ModX behind and this is one of the last hurdles.
Cheers,
Tom
Posts: 6,266
Threads: 181
Joined: Sep 2011
This is a limitation as of right now, there is another thread with some workarounds to using relative links in the editor posted as well that requires a single modification of a core file.
Posts: 6,266
Threads: 181
Joined: Sep 2011
Posts: 51
Threads: 3
Joined: Jul 2013
Yeah, I tried all those, but it doesn't work here.
Well, if it can't be changed, I'll keep doing my silly routine until I'll be good enough in php and understand enough about GS to properly propose a solution ;-)
Cheers,
Tom
Posts: 3,491
Threads: 106
Joined: Mar 2010
I just created a small plugin as a workaround for this: FixSiteURL
Posts: 51
Threads: 3
Joined: Jul 2013
Brilliant - Problem solved for me.
Thanks a ton!
Cheers,
Tom
Posts: 51
Threads: 3
Joined: Jul 2013
2013-08-14, 04:43:06
(This post was last modified: 2013-08-14, 05:00:08 by Thomas Helzle.)
First problem: I use the "I18N Custom Fields" plugin to set things like page background image, page thumbnail etc. and those aren't translated. Is it possible to set an "order of execution" for plugins so that yours is executed after the Custom Fields were evaluated?
I found the Plugin-Reordering-Plugin - I'll try that one.
Cheers,
Tom
Posts: 3,491
Threads: 106
Joined: Mar 2010
This simple plugin only processes the content field (and get_page_content()'s output), not any others like custom fields. (reordering the execution will not fix anything, that's not the problem)
I'll see if I can do something about this...
Posts: 51
Threads: 3
Joined: Jul 2013
Ah, I see.
Well, I personally wouldn't be here if the i18n suite of plugins wouldn't exist. Without them, GS is really a bit too simple for my needs. But with mvlceks tools, GS is able to compete with almost all important aspects of ModX, which I was using before.
ModX is quite bloated and the backend rather slow to use, although it's a pretty mighty and deep system similar to GS in many ways ("Non-Blackbox-CMS" I'd call it).
So for me, only everything i18n together with the SimpleInputTabs plugin makes GS into a "complete" CMS.
Which is a long way of saying: it would be cool if those plugins could be supported by the fixsiteURL plugin ;-)
I still wonder though, if replacing the _currently_ used Site URL directly when using the file browser (be it in a plugins GUI or in the content frontend) with a dynamic placeholder wouldn't be a more general and complete solution.
From the several threads I read about the topic I take it that this is complicated because of the used editor and browser components, but still it seems to me to be the only real solution that could work everywhere, even with multiple systems used in a roundtrip way (like two developers with different local structures working on the same site plus the site itself for instance).
I thank you VERY much for your help with this!
Cheers,
Tom
Posts: 104
Threads: 6
Joined: Aug 2013
Correct me if im wrong but another way would be making a plugin with a simple form on the backend (old path field, new path field) that searches/replaces all the old paths with new paths directly in the xml files(?).
Posts: 3,491
Threads: 106
Joined: Mar 2010
(2013-08-15, 03:47:35)Kolyok Wrote: Correct me if im wrong but another way would be making a plugin with a simple form on the backend (old path field, new path field) that searches/replaces all the old paths with new paths directly in the xml files(?).
Yes of course, I even suggested something like that in that other thread.
(But I thought it could be interesting/useful to have a plugin like this FixSiteURL)
Posts: 3,491
Threads: 106
Joined: Mar 2010
2013-08-17, 18:15:12
(This post was last modified: 2013-08-18, 17:31:32 by Carlos.)
Here's a simple script (not a plugin, so no backend, sorry) to search/replace old->new site URLs in all files in a folder.
... [moved to this thread]
|