Get component content in joomla

余生长醉 提交于 2019-12-13 04:14:03

问题


I'm making a system plugin and I need a way to put html before any components and after header,menu ecc. in other words I need to put html before this in template:

<jdoc:include type="component" />

Thank you


回答1:


I found what I need:

  // get the document object.
  $doc = JFactory::getDocument();

  // get the buffer
  $buffer = $doc->getBuffer('component');

  // your string to insert
  $insert_string = "<p>I've been inserted</p>";

  // insert the string
  $buffer = $insert_string . $buffer;

  // reset the buffer
  $doc->setBuffer($buffer, 'component');



回答2:


If you want to modify the contents of the webpage then you should be making a "content" plugin as opposed to a "system" plugin.

A good place to start is by looking at the emailcloak plugin that ships with Joomla! 1.6+ (note that the plugin interface is quite different for Joomla! 1.5 versus the current 1.6/7/2.5 era plugins). If you're working with 1.5 then have a look the example plugin that ships with it.

This doc covers "Creating a content plugin"



来源:https://stackoverflow.com/questions/9145248/get-component-content-in-joomla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!