通过AJAX执行子控制器调用
我正在创建一个 Joomla 插件,并且创建了一个自定义任务(换句话说,一个新函数),我想创建一个子控制器文件来插入它。
问题是我正在编写一个插件,我想添加一个新的自定义任务而不更改 components/com_content/controller.php
文件。所有这一切都是因为我不知道如何在安装插件期间将我的tack-function添加到controller.php
。
事实上,如果我只是将新函数插入上述 controller.php
中,我就没有问题。
我尝试编写一个子控制器,正如我在这里读到的: 使用 Joomla,我如何进入 AJAX 调用,仅调用由 php 函数生成的输出?
Scilicet:
1)我创建了一个新的子控制器文件: /components/com_content/controllers/myTaskController.raw.php
。在这个新的控制器文件中,我也创建了一个新类之后,尝试仅插入我的自定义任务函数(myTaskFunction
)。但它不起作用:(
2) 然后我使用 url index.php?option=com_content&task=myTaskController.myTaskFunction&format=raw
调用自定义任务。但它不起作用:(
我哪里出错了?
I'm creating a Joomla plugin and I've created a custom task (in other words, a new function) and i would like to create a sub-controller file in which to insert it.
The problem is that i'm writing a plugin and i want to add a new custom task without altering components/com_content/controller.php
file. All this because i do not know how to add my tack-function to controller.php
during installation of the plugin.
In fact, I have no problems if I simply insert my new function in the above-mentioned controller.php
I've tried to write a sub-controller as I've read here:
With Joomla, how do I get into an AJAX call only the output generated by the php function called?
Scilicet:
1) I've created a new sub-controller file: /components/com_content/controllers/myTaskController.raw.php
. In this new controller file I have tried to insert only my custom task-function (myTaskFunction
), after I've created a new class, too. But it doesn't work :(
2) Then I call the custom task using the url index.php?option=com_content&task=myTaskController.myTaskFunction&format=raw
. But it doesn't work :(
Where have I gone wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论