在空白页面上呈现的Joomla模块或组件 [英] Joomla module or component to be render on a blank page
问题描述
我已经开发了一个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.
我希望代替JavaScript,为打印视图提供单独的URL,并在_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屋!