[英]Joomla Ajax download text editor
I'm trying to figure out how to load an editor box using Ajax this is for the admin side structure looks like admin 我试图弄清楚如何使用Ajax加载编辑器框,这是因为管理端的结构看起来像admin
-controllers -控制器
--orderitem.php --orderitem.php
-views 视图
--orderitem -订单项
---tmpl --- tmpl
----orderitem.php ---- orderitem.php
---view.raw --- view.raw
---view.html --- view.html
-controller.php -controller.php
I've built and have working ajax passing a json object to the server and back. 我已经构建好了,并且正在工作的ajax将json对象传递到服务器并返回。 Currently it passes a plain text field back.: 当前,它将纯文本字段传递回:
if(get_magic_quotes_gpc()){
$test = stripslashes($_POST['json']);
}else{
$test = $_POST['json'];
}
$obj = json_decode($test);// passes data up to the $obj
$obj->{'postsHolder'} = "
<div>
Message:<br>
<textarea id='message".$invoiceid."' rows='15' cols='60' >
test text
</textarea><br>
</div>";
$reply = json_encode($obj);
echo $reply;
JFactory::getApplication()->close();
then I just load the returned object into a div using mootools: 然后我只是使用mootools将返回的对象加载到div中:
$(targetdiv).setProperty('html',jsonObj.postsHolder);
I know it's possible to use a joomla text editor but can't figure out how to do it with AJAX. 我知道可以使用joomla文本编辑器,但无法弄清楚如何使用AJAX进行编辑。 I'm guessing I need to do something with XML since I've used that before to get a text editor in my components (just not through AJAX) 我猜我需要对XML进行一些操作,因为我之前曾使用过XML,以便在我的组件中获得文本编辑器(只是不通过AJAX)
Any help would be really great 任何帮助都将非常棒
thanks 谢谢
I don't really understand what your problem is but hope this helps. 我不太了解您的问题所在,但希望对您有所帮助。
To get the editor from Joomla you need to call it this way 要从Joomla获得编辑器,您需要这样调用
$editor = JFactory::getEditor();
$params = array( 'smilies'=> '0' ,
'style' => '1' ,
'layer' => '0' ,
'table' => '0' ,
'clear_entities'=>'0'
);
echo $editor->display( 'desc', '', '400', '400', '20', '20', false, $params );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.