如何在页面中嵌入模块?
我创建了自己的扩展和模块。我可以通过访问模块的 URL 来很好地查看模块。但是,现在我想将它们嵌入到页面上,就像内容类一样。我该如何去做呢?
谢谢!
I have created my own extension and modules. I can view the modules fine, by going to their URL. However, now I want to embed them on a page, much like a content class. How do I go about doing that?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须创建模板运算符或函数并在模板中使用它们。
You have to create template operator or function and use them in template.
除非调用的模块是在 PHP 级别执行的,否则不可能将模块“嵌入”到页面中。
例如,可以这样写:
但是如果您想显示与您的模块相关的任何内容,您应该声明您的扩展包含一些模板并覆盖一些模板。
假设您想制作自己的寄存器模块。
第 1 步,您可能需要在
your_extension/settings/design.ini.append.php
中添加此内容:这样您现在就可以添加自己的
user/register.tpl
该模板包含这样的表单:
因此您只需复制该模板,但使用:
现在假设您的模板应该显示一些与您的模块相关的信息。您可能必须定义一些获取函数,以便你可以写这样的东西:
我希望它会有所帮助......
It is not possible to "embed" a module in a page except if the module which is called do it at the PHP level.
For instance, it's possible to write this :
But if you want to display anything related to your module, you should declare that your extension contains some templates and override some templates.
Let's say that you would like to make your own register module.
Step 1, you may have to add this in
your_extension/settings/design.ini.append.php
:So you are now able to add your own
user/register.tpl
This template contains a form like this :
So you just need to copy the template but with :
Now let's say that your template is supposed to display some informations related to your module. You may have to define some fetch functions so you would be able to write something like this:
I hope that it will help...