Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Relative path vs full path for images and PDF links
#14
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
Reply


Messages In This Thread
RE: Relative path vs full path for images and PDF links - by Thomas Helzle - 2013-08-13, 02:54:53



Users browsing this thread: 1 Guest(s)