如何从 Joomla 向自己发起 AJAX 调用!模块?

发布于 2024-11-25 03:56:12 字数 340 浏览 4 评论 0原文

我编写了一个依赖于某些第三方设备(加载、解析和显示)的模块。有时需要 5 秒才能响应,所以我尝试使用 ajaxify 这部分。

我的乔姆拉!模块已准备就绪,并且已使用 AJAX (mootools) 编写代码,但我无法找出访问 Joomla“注入”的模块 php 文件的 URL! (类似于 /index.php?option=com_content)。我可以硬编码并访问它(/modules/mod_a/xyz.php),但我会遇到“不允许直接访问”,这没有问题,但我没有 Joomla!我非常怀念的背景。

我发现的所有组件都使用了我非常想避免的组件。

感谢您的建议,

问候,

马雷克

I wrote a module that is dependent on some third party device (load, parse & display). Sometimes it takes 5 seconds for it to respond so I tried to ajaxify this part.

My Joomla! module is ready as well as code with AJAX (mootools) but I can't figure out the URL to access my module php file "infused" by Joomla! (something like /index.php?option=com_content). I can hardcode and access it (/modules/mod_a/xyz.php) but I will run into "direct access not allowed" which is no trouble, but I don't have the Joomla! context which I pretty much miss.

All I found utilizes components which I would very much like to avoid.

Thanks for suggestions,

Regards,

Marek

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蹲在坟头点根烟 2024-12-02 03:56:12

您无法通过 url 访问您的模块。为此目的,使用一个模型和一个视图创建非常简单的组件的唯一方法。或者,您可以将一项任务添加到站点中安装的组件之一。

You cannot access to your module by url. The only way to create very simple component with one model and one view for this purpose. Or you could add one task to one the components installed in your site.

許願樹丅啲祈禱 2024-12-02 03:56:12

我确实编写了最简单的组件(没有 MVC):

defined('_JEXEC') or die('Restricted access');
$task = JRequest::getWord('task');
if ($task == "getCurrentTemp") {
 // return temperature
}

这可以通过 JURI::current()."index.php?option=com_xzy&task=getCurrentTemp" 打印(heredoc)到 JS 。
无法访问模块有点糟糕,但我从架构的角度理解这一点。

I did write the simplest component I could (no MVC):

defined('_JEXEC') or die('Restricted access');
$task = JRequest::getWord('task');
if ($task == "getCurrentTemp") {
 // return temperature
}

This can be printed (heredoc) to JS by JURI::current()."index.php?option=com_xzy&task=getCurrentTemp".
Not being able to access module sucks a little bit but I understand that from architectural point of view.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文