Joomla component: Output without html

浪尽此生 提交于 2019-12-17 20:45:17

问题


I am developing a Joomla component for Joomla 2.5. Since it's supposed to output XML, I most defenitely don't want to display the surrounding template.

I have tried appending to the url:

  • ?tmpl=component
  • ?format=raw
  • ?tmpl=raw

But the first will generate some HTML around the content output and the second gives me a 500 error. The third one generates no output at all. I assume it's looking for a template named "raw", because any other gibberish template name I put there gives me the same result.

How can I output XML from my component without any of the additional Joomla + template HTML?


回答1:


In Joomla! 1.5 all you had to do is add ?tmpl=component&format=raw but to achieve raw display

In Joomla! 2.5 you need to make view.raw.php file which can be identical to your existing view.html.php, but that depends on your needs. And also in the controller you have to manually instantiate raw view because default type is html.

A very good example you can find in file administrator/components/com_banners/controllers/tracks.raw.php which is the part of default components shipped with Joomla.



来源:https://stackoverflow.com/questions/10739611/joomla-component-output-without-html

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