禁用模式框内的 Joomla 模板
我正在为后端开发一个简单的 Joomla 模块,并且我试图保持简单。我需要创建某种弹出框,可以是 JavaScript 弹出窗口,也可以是模式框。我想要弹出窗口中的一些基本内容,以及 Joomla 的用户验证,但不显示 Joomla 模板。对于组件,我可以编写这样的 url:
http://my-site.com/index.php?option=com_component&tmpl=component
此 url 只会显示组件的内容,同时仍确保用户已登录。我想知道是否有任何方法可以为模块执行此操作。这里有一些选项:
- 编写一个仅输出模块内容的 url,并禁用 Joomla 模板。
- 目前,模式框使用 iframe 在其中包含另一个页面。有什么办法可以用内容替换iframe吗?
- 在服务器上创建一个直接请求的文件,并在顶部添加用户验证检查。我可以包含任何单个 Joomla 文件来确保用户已登录吗?
- 如果一切都失败了,我可以使用 die(); 来跳过编写模板。
我正在使用 Joomla 1.5
I am developing a simple Joomla module for the backend, and I am trying to keep it simple. I need to create some kind of popup box, either with a javascript popup window or a modal box. I want some basic content inside of the popup, with Joomla's user validation, but without the Joomla template being displayed. With a component, I could write a url like this:
http://my-site.com/index.php?option=com_component&tmpl=component
This url would only show the component's content, while still making sure the user is logged in. I am wondering if there is any way to do this for a module. Here are some options:
- Write a url that will output only the module's contents, and disable the Joomla template.
- Currently, a modal box uses an iframe to include another page inside of it. Is there any way to replace the iframe with content?
- Create a file on the server that is requested directly, and add a user validation check at the top. Is there any single Joomla file that I could include that would make sure that the user is logged in?
- If all else fails, I can use
die();
to skip writing the template.
I am using Joomla 1.5
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,Joomla 有一个内置的模式框,可以在 iFrame 或 div 中显示内容。唯一需要的元素是将“modal”类添加到链接。您还可以传递多个参数来控制灯箱,您可以在此处找到有关这些参数的文档 -
http://digitarald.de/project/squeezebox/1-1/showcase/get-elements/
接下来,默认情况下,您不能只显示模块位置的内容。 tmpl=component 参数告诉 joomla 仅加载站点的组件区域,忽略所有模块位置,因此您的模块不会显示在页面上。您需要使用 {loadposition} 将模块加载到文章中,或者找到其他方法将内容放入站点的组件区域。
在灯箱中提供指向实际网站和您想要的内容的链接会很有帮助,这通常是一个非常简单的过程,我们一直对各种内容执行此操作。
First, Joomla has a built in modal box that will display content either in an iFrame or a div. The only required element is adding the class "modal" to the link. You can also pass several parameters to control the lightbox, you can find documentation on those here -
http://digitarald.de/project/squeezebox/1-1/showcase/get-elements/
Next, by default, you cannot display just the content of a module position. The tmpl=component parameter tells joomla to only load the component area of the site, ignoring all of the module positions, so your module would not show up on the page. You would either need to load the module in to an article using {loadposition} or find some other way to put the content in to the component area of the site.
It would be helpful to have links to the actual site and the content you want in a lightbox, this is usually a pretty simple procedure, we do it all the time for all sorts of content.