I read some posts here, that people have problems to link to there own pages like intern cms linking. Here is an easy way with a simple plugin and php.
Step 1:
Make a new folder named 'internlink' in /plugins folder.
Step 2:
Copy following to 'plugin.js' into /internlink folder:
CKEDITOR.plugins.add( 'internlink' );
CKEDITOR.scriptLoader.load( CKEDITOR.plugins.getPath( 'internlink' ) + 'internpages.php' );
CKEDITOR.on( 'dialogDefinition', function( ev )
{
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if ( dialogName == 'link' )
{
var infoTab = dialogDefinition.getContents('info');
infoTab.add( {
type : 'select',
id : 'intern',
label : 'Intern Page',
'default' : '',
style : 'width:100%',
items : InternPagesSelectBox,
onChange : function()
{
var d = CKEDITOR.dialog.getCurrent();
d.setValueOf('info', 'url', this.getValue());
d.setValueOf('info', 'protocol', !this.getValue() ? 'http://' : '');
},
setup : function( data )
{
this.allowOnChange = false;
this.setValue( data.url ? data.url.url : '' );
this.allowOnChange = true;
}
}, 'browse' );
dialogDefinition.onLoad = function()
{
var internField = this.getContentElement( 'info', 'intern' );
internField.reset();
};
}
} );Step 3:
Copy following as 'internpages.php' to /internlink folder:
<?PHP
header('Content-type: application/javascript');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0, false');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Pragma: no-cache');
/*
The Example read files of a directory and outputs
a javascript array. Output is:
var InternPagesSelectBox = new Array(
new Array( empty, empty ),
new Array( name, link ),
new Array( name, link )...
);
InternPagesSelectBox will loaded as select options
to internlink plugin.
*/
$directory = $server_path."/pages";
$handle = opendir ($directory);
echo "var InternPagesSelectBox = new Array( new Array( '', '' )";
while (false !== ($file = readdir ($handle))) {
if ( $file != "." && $file != ".." )
echo ", new Array( '".$file."', 'index.php?page=".$file."' )";
}
echo " );\n";
closedir($handle);
?>This code is only an example. Make changes, what you need is InternPagesSelectBox array. It's loaded to plugin as select options.
Step 4:
Load plugin with your config:
extraPlugins : 'internlink'
That's it
