GetSimple Support Forum

Full Version: image path in GS 3.x.x
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi @ll,

is there any possibility to use a default path like the path in the templates for example:

Code:
<img src="<?php get_site_url(); ?>/data/uploads/images/logo.gif" alt="Logo">

that i have allways the correct path the the images inside my content ?

currently i have a path like this:

http://domain.tld/data/uploads/images/test.jpg

now if i change the installation to another location or i make any tests or updates the path are no longer correct which was made by the WYSIWYG Editor inside GS.

if it is possible to change to a path like this inside the editor or to

/data/uploads/images/logo.gif

an the system find the "<?php get_site_url(); ?>" automatic this looks good.

Any solution for this issue?

Hope anyone can help.

best regards,

Harald
I don't fully understand why, but you can't use php tags in the page content. You can use your get_site_url() php for links in the template and in a component like the sidebar but not in the main page content.
I think he means via ckeditor , no urls are full static, but there are replacer
Plugins to fix this for now.
(2014-04-27, 05:01:37)Timbow Wrote: [ -> ]I don't fully understand why, but you can't use php tags in the page content. You can use your get_site_url() php for links in the template and in a component like the sidebar but not in the main page content.

Most CMSes only allow html in page/post contents. Some also use some kind of shortcode system.

Allowing/using php in content can be dangerous. You can easily break your site if you just miss a comma or a parenthesis or anything, and is also a security hole if there are non-admin editor users (if you use some plugin that restricts user privileges)

Just like with e.g. Wordpress (which is similar to GS in several aspects), best solution is using one of the several plugins that allow inserting shortcodes/placeholders for php functions. (e.g. DynPages or ShortCodes in GS)

Anyway if you want PHP you can use the Exec-PHP plugin.
correct i mean ckeditor.

Is there any solution that i can use static path instead of URL ?
If yes which plugin or modification of ckeditor make what i like to have ?
@Carlos

no i don´t like php code inside my contect i like this only to use allways the same base for the path of my images etc. Is there no other way to do that ?
hmm... thanks for the link but i don´t understand the function of this plugin :-(
if i use exec_php plugin i get the correct path but i have to implement all images by hand Sad

I see you are active in the ckeditor forum to did you found any solution to fix this (not get simple issue)
directly inside ckeditor?

I search inside the .js file of ckeditor and i see that ckeditor use a function called .geturl to find his own installation location.

Is there any possibliliy to make a plugin like fancy box to use this geturl
function to find all ways the correct path of the images is we use ckeditor inside get simple ?

part of the ckeditor docs:
Code:
getUrl( resource ) : String

Gets the full URL for CKEditor resources. By default, URLs returned by this function contain a querystring parameter ("t") set to the timestamp value.

It is possible to provide a custom implementation of this function by setting a global variable named CKEDITOR_GETURL. This global variable must be set before the editor script loading. If the custom implementation returns nothing (==null), the default implementation is used.

// e.g. 'http://www.example.com/ckeditor/skins/default/editor.css?t=87dm'
alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );

// e.g. 'http://www.example.com/skins/default/editor.css?t=87dm'
alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );

// e.g. 'http://www.somesite.com/skins/default/editor.css?t=87dm'
alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );

Parameters

    resource : String

    The resource whose full URL we want to get. It may be a full, absolute, or relative URL.

Returns

    String

    The full URL.
@shawn: i found this too:

http://docs.cksource.com/ckeditor_api/sy...#.baseHref

Code:
The base href URL used to resolve relative and absolute URLs in the editor content.

config.baseHref = 'http://www.example.com/path/';

Default Value:
    '' (empty)

.js code are compressed and i can not test it. Any idea that this helps ?
now i make some tests and i´m confused.

if i do the following:

ckeditor.js modification
Code:
baseHref:'<?php get_site_url(); ?>'

and i add a picture to a sample side like this:

<img style="width: 333px; height: 152px;" src="http://testdomain.com/pmm/data/uploads/banner.png" alt="">

</img>

the picture shows on the content page (okay)!

Now i modify the path of the installation to:
http://testdomain.com/pmm111

and settings of GS too the picture shown again on the page !

But you know that the real path of the shown path

<img style="width: 333px; height: 152px;" src="http://testdomain.com/pmm/data/uploads/banner.png" alt="">

</img>

are wrong than we change to "pmm111" okay ?!

But it works !

If i remove now the tag from the ckeditor.js file again (restore old one)

the pictures do not shown in the content page (normal corrent than the path are no longer "pmm" now real "pmm111"

Anyone understand this ?

Is it correct that we found now any solution to manipulate the path if we move a page ?
There is a thread about changing the code to use relative urls in ckeditor to some success.

Everyone else uses one of the 2 the url changer plugins.
So unless you are loading your site from 2 distinct urls and need that to work the plugins will work, they might even let you change to relative urls, in which case it does exactly what you need, i have never used them.
the ts-changer do not work on my side ! Which other plugin i can use ? You wrote "2 plugins"
Some more options:

A way to use relative-to-root paths:
http://get-simple.info/forums/showthread...4#pid39014
(the idea is using them temporarily while the site is being developed)

My quickie plugin:
http://get-simple.info/forums/showthread.php?tid=5061

If you're going to use any of those methods, backup everything before doing so, just in case.