Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding link to local page in CKEditor broken
#1
Hi.

Looking for a simple NoDB CMS for two small websites, I started checking out GetSimple one month ago. I have set up several installations to test everything thoroughly and ran into several problems.

As the backend users of one of the websites will need a simple-to-use interface, CKEditor is required, editing HTML source is no option for them.
  • Test installation of GS with Bootstrap 3 theme installed
  • Added a couple of pages with filler text
  • Tried to create a link to page B from page A using CKEditor's link insertion dialogue. Link type: Link to local page; Select page: page B.

Instead of the expected relative link with the title of the page as link text, <a href="pageB">page B</a> I get, <a href="http://domain/path/pageB">http://domain/pageB</a>.

This happens with all four installations of GS I have currently running locally.

How do I get relative Links without editing the source?
I expect I will have to sync my own local (edited) installation with changes made on the (test) server frequently and want to avoid frequent unneccessary manual changes to the files.

Andreas
Reply
#2
You can't . See the many threads about cke relative links.
And the solutions
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
heres one
http://get-simple.info/forums/showthread...solute+url

hers another
http://get-simple.info/forums/showthread...olute+urls

maybe someone will make a sticky one day
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#4
and another thread
http://get-simple.info/forums/showthread.php?tid=2816

and related
http://get-simple.info/forums/showthread.php?tid=5082
(note: I think there's also a plugin in Extend that does something similar)
Reply
#5
What about using links like: http://../data/uploads/img.jpg or http://../page2 (other page at same level) or http://./page2 (subpage)?
Reply
#6
(2015-01-09, 23:43:22)datiswous Wrote: What about using links like: http://../data/uploads/img.jpg or http://../page2 (other page at same level) or http://./page2 (subpage)?

Sorry, I do not understand this. Can you please rephrase it? Thank you.
Reply
#7
(2015-01-09, 07:01:08)shawn_a Wrote: heres one
http://get-simple.info/forums/showthread...solute+url

hers another
http://get-simple.info/forums/showthread...olute+urls

maybe someone will make a sticky one day

Thank you for the links.

I found this:


CKEditor Tutorial: Adding a ‘Link to local page from site’ field
Posted on November 24, 2010
http://blog.xoundboy.com/?p=393

which, in turn, points to the updated version of the plugin at GitHub:
https://github.com/simogeo/ckeditor-adv_link

I also looked at /<GS base folder>/admin/template/js/ckeditor/config.js, where you find the code for the local link functionality (starting with line 85). There, I stumbled upon this commented-out piece:

Code:
// this.getContentElement('info', 'localPage_path').select(); // disabled, object has no method select

Is this possible the part where the actual replacement of the URL with the local path would have happened?
Reply
#8
By the way: I am also wondering why ckeditor does not use the selected pages title as link text (i.e. the part between <a> and </a> but inserts the URL.
Reply
#9
no gs uses absolute urls, 3.4 will allow this to change.
those threads provide possible solutions from plugins that rewrite them using content filters or modifying the code to remove the $SITEURL from the path.

cke editor inserts whatever we give it
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#10
(2015-01-11, 01:48:49)shawn_a Wrote: no gs uses absolute urls, 3.4 will allow this to change.
those threads provide possible solutions from plugins that rewrite them using content filters or modifying the code to remove the $SITEURL from the path.

cke editor inserts whatever we give it

Hi Shawn,

thanks for the info. When will 3.4 be ready? I only found a 3.3.5 beta.
Reply
#11
No time soon your best bet is to use one of the plugins made for this or modify the urls from the function that provides them.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#12
(2015-01-10, 23:06:53)WerWieWas Wrote:
(2015-01-09, 23:43:22)datiswous Wrote: What about using links like: http://../data/uploads/img.jpg or http://../page2 (other page at same level) or http://./page2 (subpage)?

Sorry, I do not understand this. Can you please rephrase it? Thank you.

Well I just found out you can use links with an url like:

http://../data/uploads/yourimg.jpg (this is the full url, apart from the filename)

instead of:

http://www.yoursite.com/data/uploads/yourimg.jpg

So if it was http://localhost/data/uploads/yourimg.jpg and now http://www.yoursite.com/data/uploads/yourimg.jpg it would both work with http://../data/uploads/yourimg.jpg

In the output the links have the right url.

Edit: It seams the http:// in the url isn't needed. The Ckeditor gui doesn't work propperly with it though.

Also in the source of the page you still see the ../data/uploads/yourimg.jpg , so maybe bad for seo. Also, I didn't test this with more than one browser.
Reply
#13
(2015-01-12, 20:56:13)datiswous Wrote: ...

Well I just found out you can use links with an url like:

Thank you! Sounds interesting as a workaround.
Reply
#14
(2015-01-12, 09:58:38)shawn_a Wrote: No time soon your best bet is to use one of the plugins made for this or modify the urls from the function that provides them.

Yes, I shall check out the plugins.

Thinking about the problem again, I believe it may yet be a problem inside ckeditor: I get the weird result for selecting a local link inside ckeditor, not only after saving, but right away after entering the link. Is there interaction between ckeditor and GS at this time? Not only after saving the contents of an editor field? And why the wrong text between <a> and </a> (i.e. the URL again, instead of the selected internal page)?
Reply
#15
I am wondering: does anyone here know why GS is using http URLs for local files?
There is no advantage I see in this, but these disadvantages:
  • Clicking on such a link results in additional DNS requests for a local file, or doesn't it?
  • Migrating pages (which should be super-easy as GS is a flat file CMS) becomes more problematic as internal links have to be fixed.

Am I missing something?

Oh, and thank you very much for your replies!
Reply
#16
We use absolute because every one uses them, wordpress uses them.

I have no idea why the decision was made, but 3.4 has experimental relative urls to see why.


ALSO
ckeditor gets its links from

PHP Code:
/**
 * List Pages Json
 *
 * This is used by the CKEditor link-local plugin function: ckeditor_add_page_link()
 *
 * @author Joshas: mailto:joshas@gmail.com
 *
 * @since 3.0
 * @uses $pagesArray
 * @uses subval_sort
 * @uses GSDATAPAGESPATH
 * @uses getXML
 *
 * @returns array
 */
function list_pages_json(){    
    GLOBAL 
$pagesArray,$pagesSorted;

    
$pagesArray_tmp = array();
    
$count 0;
    foreach (
$pagesArray as $page) {
        if (
$page['parent'] != '') { 
            
$parentTitle returnPageField($page['parent'], "title");
            
$sort $parentTitle .' '$page['title'];        
        } else {
            
$sort $page['title'];
        }
        
$page array_merge($page, array('sort' => $sort));
        
$pagesArray_tmp[$count] = $page;
        
$count++;
    }
    
$pagesSorted subval_sort($pagesArray_tmp,'sort');

    
$links exec_filter('editorlinks',get_link_menu_array());
    return 
json_encode($links);


as you can see there is a editorlinks filter hook in there
anyone can write a plugin to change this behavior, as of 3.3 or something
( I added it to the wiki, it was missing )
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#17
I created an issue on the other behavior you noticed, I don't know if this ever worked like that, or if no one ever mentioned it before. But it makes sense.

https://github.com/GetSimpleCMS/GetSimpl...ssues/1000
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#18
Try this plugin I whipped up
http://get-simple.info/forums/showthread.php?tid=7035
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#19
(2015-01-13, 01:30:49)shawn_a Wrote: We use absolute because every one uses them, wordpress uses them.

I have no idea why the decision was made, but 3.4 has experimental relative urls to see why.

Thank you for the clarification.

Quote:ALSO
ckeditor gets its links from [...]

Hey, great! Though I am not sure I can reprogram this myself as I am a PHP newbie. Maybe I will try it anyway.
Reply
#20
lol
I just posted the plugin man, I went ahead and wrote it for you.

http://get-simple.info/forums/showthread.php?tid=7035
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#21
(2015-01-13, 02:26:10)shawn_a Wrote: Try this plugin I whipped up
http://get-simple.info/forums/showthread.php?tid=7035

Great, thank you! Will try it out ASAP.
And thanks for the GitHub issue, too.
Reply




Users browsing this thread: 2 Guest(s)