
Testowane na localhoście, i na wirtualnym serwerze OVH.
ścieżki do folderu z plikai na pewno są poprawne, bo utworzyłem odpowiedni folder (upload) w kilku miejscach (od katalogu głownego, aż do podfolderu z kc finderem) dla pewności, bo już zwątpiłem.
adres odnośnika (tej ikonki koło inputa) do kcfindera to JS i u mnie wygląda tak samo jak w wersji demonstracyjnej): java script:openBrowser('srcbrowser','src',%20'image','theme_advanced_image_image_browser_callback');
tinyMCE.init wygląda następująco.
Kod
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
language : "pl",
plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inl
inepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,dir
e
ctionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wo
r
dcount,advlist,autosave",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright
,justifyfull,|,bullist,numlist,blockquote,|pasteword,|,link,unlink,image,forecol
o
r",
theme_advanced_buttons2 : "tablecontrols,|,charmap,emotions,|,insertdate,inserttime,preview",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "css/content.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
// Style formats
style_formats : [
{title : 'Bold text', inline : 'b'},
{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
{title : 'Example 1', inline : 'span', classes : 'example1'},
{title : 'Example 2', inline : 'span', classes : 'example2'},
{title : 'Table styles'},
{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
],
file_browser_callback: 'openKCFinder',
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
function openKCFinder(field_name, url, type, win) {
tinyMCE.activeEditor.windowManager.open({
file: '/kcfinder/browse.php?opener=tinymce&type=' + type,
title: 'KCFinder',
width: 700,
height: 500,
resizable: "yes",
inline: true,
close_previous: "no",
popup_css: false
}, {
window: win,
input: field_name
});
return false;
}
</script>
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
language : "pl",
plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inl
inepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,dir
e
ctionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wo
r
dcount,advlist,autosave",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright
,justifyfull,|,bullist,numlist,blockquote,|pasteword,|,link,unlink,image,forecol
o
r",
theme_advanced_buttons2 : "tablecontrols,|,charmap,emotions,|,insertdate,inserttime,preview",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "css/content.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
// Style formats
style_formats : [
{title : 'Bold text', inline : 'b'},
{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
{title : 'Example 1', inline : 'span', classes : 'example1'},
{title : 'Example 2', inline : 'span', classes : 'example2'},
{title : 'Table styles'},
{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
],
file_browser_callback: 'openKCFinder',
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
function openKCFinder(field_name, url, type, win) {
tinyMCE.activeEditor.windowManager.open({
file: '/kcfinder/browse.php?opener=tinymce&type=' + type,
title: 'KCFinder',
width: 700,
height: 500,
resizable: "yes",
inline: true,
close_previous: "no",
popup_css: false
}, {
window: win,
input: field_name
});
return false;
}
</script>
Z ciekawości zmieniłem ścieżkę w tej linijce:
Kod
file: '/kcfinder/browse.php?opener=tinymce&type=' + type,
najpierw na zwykłą ścieżkę bezwzględną, a następnie na względną. o dziwo zaczęło wyświetlać KCEditor'a, ale z błędami (require pliku nie działa).
Jak nie będziecie w stanie mnie naprowadzić na jakiś trop, to uderzę głową w ścianę... o tak -->




Oczywiście jak zawsze z góry wielkie dzięki i pozdro za choćby ew. chęć pomocy :-)
PS. znacie jakieś aktualne paczki z gotowymi WYSiWYG'ami połączonymi z filemanagerami?