編集開始
OKなので、以下は機能しますが、より良い方法を見つけました。あなたのコントローラーで...
if (JRequest::getVar('format') != 'raw') {
$url = JURI::current() . '?' . $_SERVER['QUERY_STRING'] . '&format=raw';
header('Location: ' . $url);
// or, if you want Content-type of text/html just use ...
// redirect($url);
}
編集を終了
Babur Usenakunov によって提案されているように、「tmpl」を「component」に設定できます。この場合、次のようにスクリプトと css をロードできます。
JRequest::setVar('tmpl','component');
ただし、生の出力を作成する場合は、 &format=raw を追加するか、コンポーネントで「生」タイプのビューを作成します ...
残念ながら、raw render の viewType を正しく作成する唯一の機能的な方法は、view クラスが parent::display() を呼び出した後に exit() を呼び出すことです ...
あなたのcontroller.phpで...
class com_whateverController() extends JController
{
function __construct()
{
// the following is not required if you call exit() in your view class (see below) ...
JRequest::setVar('format','raw');
JFactory::$document = null;
JFactory::getDocument();
// or
//JFactory::$document = JDocument::getInstance('raw');
parent::__construct();
}
function display()
{
$view = $this->getView('whatever', 'raw');
$view->display();
}
}
次に、views/whatever/view.raw.php で ...
class com_whateverViewWhatever extends JView
{
public function display($tpl = null)
{
parent::display();
exit; // <- if you dont have this then the output is captured in and output buffer and then lost in the rendering
}
}