在JDocument type RAW上运行内容插件(即temp。用其他类型替换JDocument)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在JDocument type RAW上运行内容插件(即temp。用其他类型替换JDocument)相关的知识,希望对你有一定的参考价值。

Say you want to run content plugins on JDocumentRAW content (like in a component that returns JSON data). Some methods in JDocumenthtml like "addCustomTag" will cause the app to fail on JDocumentRAW doc types which don't have this method. Thus you need to temporarily replace it to trick the content plugins...
  1. $document =& JFactory::getDocument();
  2. $oldDoc = clone( $document );
  3. $document = JDocument::getInstance('html');
  4.  
  5. JPluginHelper::importPlugin('content');
  6. $article = new JObject();
  7. $article->text = $lesson->rendered;
  8. $dum = array();
  9. $dispatcher->trigger( 'onPrepareContent', array( &$article, &$dum, 0 ) );
  10. $lesson->rendered = $article->text;
  11.  
  12. $document = $oldDoc;

以上是关于在JDocument type RAW上运行内容插件(即temp。用其他类型替换JDocument)的主要内容,如果未能解决你的问题,请参考以下文章

3K/4K 双USB Type-C接口盲插便携显示器解决方案

1080P/2K 双USB Type-C接口盲插便携显示器解决方案

1080P/2K 双USB Type-C接口盲插便携显示器解决方案

当移动硬盘识别盘符并变成RAW打不开的解决办法

reifiable type与raw type

Python 输入输出