要在空白页面上呈现的 Joomla 模块或组件 [英] Joomla module or component to be render on a blank page

查看:21
本文介绍了要在空白页面上呈现的 Joomla 模块或组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个 Joomla 模块,它确实提供了一个表单、处理其发布数据、进行一些计算并显示结果.

I have developed a Joomla module that does provides a form, processes its post data, does some calculations and displays the results.

该模块包括一个用于打印结果的按钮.我目前正在使用 JavaScript 打开一个新窗口,粘贴相关的 HTML 并打开打印对话框.

The module includes a button to print the results. I'm currently using JavaScript to open a new window, paste the relevant HTML and open the print dialog.

我更愿意为打印视图提供一个单独的 URL,而不是 JavaScript,只需在 _blank 目标中打开它.这将使应用程序更适合使用屏幕阅读器或没有 JavaScript 的人使用.

Instead of JavaScript I would prefer to provide a separate URL for the print view and simply open that in a _blank target. This would make the application work better for people using screen readers or not having JavaScript available.

有什么办法可以告诉 Joomla 不要将模板与我的模块一起呈现?我在想创建一个组件可以解决这个问题,但不得不发现组件也被渲染到模板中......

Is there any way that I can tell Joomla to not render the template along with my module? I was thinking that creating a component fixes that issue, but had to find that components are rendered into the template, too...

顺便说一句:我有 Joomla 1.5.22

BTW: I have Joomla 1.5.22

推荐答案

要实现您想要的效果,您必须向请求 URL 添加额外的 tmpl=component 查询字符串参数.这将禁用模板和模块渲染.

To achieve what you want you have to add additional tmpl=component query string parameter to the request URL. This will disable template and module rendering.

您的 URL 将如下所示:index.php?option=com_xxx&view=xxx&tmpl=component

Your URL will look something like this: index.php?option=com_xxx&view=xxx&tmpl=component

由于您使用的是 Joomla 1.5,您可以请求 index2.php?option=com_xxx&view=xxx 并且它只会渲染组件.Joomla 2.5 没有 index2.php 所以如果你打算在未来迁移,不要使用这个选项.

Since you are using Joomla 1.5 you can request index2.php?option=com_xxx&view=xxx and it will only render the component. Joomla 2.5 does not have index2.php so if you plan to migrate in future, don't use this option.

如果您使用的是 SEF,则在 URL 末尾添加 ?tmpl=component 即可.

If you are using SEF then adding ?tmpl=component at the end on URL does the trick.


更进一步...在您的模板目录中有 component.php 文件,这是由 tmpl 参数加载的文件.您可以将 component.php 复制到 my_component.php,进行必要的更改并使用 index.php?option=com_xxx&view=xxx& 加载您的自定义组件模板.tmpl=my_component


To go a step deeper... in your template directory you have component.php file, that is the file that's being loaded by tmpl param. You can copy component.php to my_component.php, do necessary changes and load your custom component template with index.php?option=com_xxx&view=xxx&tmpl=my_component

这篇关于要在空白页面上呈现的 Joomla 模块或组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆