【问题标题】:Raw output in JoomlaJoomla 中的原始输出
【发布时间】:2012-12-02 16:45:54
【问题描述】:

您好,我正在从我的 Joomla 组件中的视图进行 jQuery ajax 调用。并且需要原始输出。

我尝试搜索 Joomla 文档,但找不到任何教程或文档如何使用和实现原始输出。有人有链接吗,或者可以告诉我如何使用 joomla 2.5。

真诚的莫顿

【问题讨论】:

标签: joomla


【解决方案1】:

这就是我通过 ajax 为 id 为“formdata”的 html 表单请求数据的方式。 我序列化表单中的数据,并通过 ajax 将其提交到原始视图,然后将原始视图的内容显示为 id 为“myformoutput”的 div 中的纯文本

<script type="text/javascript">
function formupdate()
{
    $.ajax({
        type: "POST",
        url: "index.php?option=com_mycomponent&view=outputview&format=raw",
        data: $('#formdata').serialize(),
        cache: false,
        success: function(html) {
        $('#myformoutput').html(html);
        }

      });   
}
</script>

原始视图来自组件com_mycomponent,视图名称为'outputview'。

'outputview' 有文件 view.raw.php 而不是 view.html.php。它包含:

class mycomponentViewoutputview 扩展 JView {

function display($tpl = null) 
    {
         echo 'this is raw text';
    }

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-13
    • 1970-01-01
    • 2015-07-15
    • 2016-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多