7. 怎样获取原始组件的输出 (for pictures, RSS-feeds etc.)
一些情况下,用户需要输出原始数据到浏览器,比如二进制的图片或者XML data。最好让Joomla来处理这样的事情。最好给组件添加一个新的任务,并通过Joomal调用,比如使用以下的地址:http:/ /www.example.com/index2.php?option=com_yourcomponent&task=your_task&no_html=1 调用组件。
如果你真的想提供一个直接的访问的文件,请确保前文中提到的第二点,其次是使用globals.php,正如以下代码:
If you really need to provide an entry point – a file that might be called directly – make sure to take care of
Joomla 1.0
define( 'YOURBASEPATH', dirname(__FILE__) );
require_once( YOURBASEPATH . '/../../globals.php' );
require_once( YOURBASEPATH . '/../../configuration.php' );
再次提醒,最好不要使用直接访问文件。