how get image list of custom folder while insert image with tinyMCE? how definite image_folder?
can help me somebody?
how get image list of custom folder while insert image with tinyMCE? how definite image_folder?
can help me somebody?
Here are a couple of sites that should be of use to you:
wiki.moxiecode.com/index.php/TinyMCE
tinymce.moxiecode.com/punbb/viewtopic.php?id=893
Basically you just specify the url, to the php file, in tinymce.init -> external_image_list_url. In the php file you then create the javascript array and echo it.
I mean extention for yii. i think i must use code like this:
$this->widget('application.extensions.tinymce.ETinyMce', array(
'model'=>$model,
'attribute'=>'good_info',
'language'=>'ru',
'editorTemplate'=>'full',
'htmlOptions'=>array('style'=>'width: 300px; height: 150px;',
'external_image_list_url'=>'myexternallist.js')
));
and where place PHP-generated image list file (http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/external_image_list_url)
?
may someone type working code - i try a lot but no result?
Hi! I’m not able to load files. There is not any way to have an uploader like wordpress?
I know that this is an old thread but it is relevant to my situation.
I am trying to do something similar to the external_image_list_url as above only I want to provide external_link_list_url to tinyMce.
So I know I need to do something like the above comment ‘create the java script array and echo it’, it seems that tinyMce is looking for a file. I assume the thing to do is to use a controller action to provide the link list and in fact this is what I have done and it works. The only problem is I have actually created a file on the disk each time a create or update action is requested. It doesn’t take long to do but to me it seems like a real hack (because it is) and what I really want to do is simulate the existence of the file.
The example php file here shows the php use of the php function header.
// Make output a real JavaScript file!
header('Content-type: text/javascript'); // browser will now recognize the file as a valid JS file
I don’t ask a lot of stupid questions but how do I do this with Yii?
doodle
Hey doodle
I am not sure if I understood your question.
You must simulate a js file with php, is that correct ?
If so, do something like
public function actionJslist(){
header('Content-type: text/javascript'); // like you said
$myArray=array('item1'=>'value1','item2'=>'value2');
echo CJavascript::encode($myArray);
}
and that is it
Hope that helps
Gustavo
Thanks a lot Gustavo!
Like I said I try not to ask too many stupid questions but every now and then one gets the better of me.
In my controller now I have
public function actionlinksFile()
{
$output = '';
$output .= 'var tinyMCELinkList = new Array('."\n";
$items = Webpage::model()->findAll();
$itemsCount = count($items);
foreach($items as $item){
$itemsCount --;
$endline = ($itemsCount > 0 ? '"],' : '"]');
$output .= '["'.$item->name.'","index.php?r='.$item->controller.'/'.$item->action.$endline."\n";
}
$output .= ');';
header('Content-type: text/javascript'); // browser will now recognize the file as a valid JS file
// prevent browser from caching
header('pragma: no-cache');
header('expires: 0'); // i.e. contents have already expired
// Now we can send data to the browser because all headers have been set!
echo $output;
}
In my view file in tinyMce init area options array.
.....
'relative_urls'=>true,
'external_link_list_url'=>Yii::app()->getBaseUrl(true).'/index.php?&r=SBPagedata/linksFile',
'theme'=>'advanced',
....
So problem solved!
Thanks again
doodle