How can you test if you#39;re on the homepage in Joomla?(你如何测试你是否在 Joomla 的主页上?)
问题描述
我在 Joomla 网站上工作,我需要首页看起来与其他页面略有不同,但不足以保证使用两个主题(更新两个样式表和每次我想做一个小的改变时都会有两组图像).
I'm working on a Joomla site, and I need the front page to look slightly different from the rest of the pages, but not enough to warrant the use of two themes (it's a pain to have to update two stylesheets and two sets of images every time I want to make a small change).
我的想法是在模板的 index.php 中进行一个小测试:如果我们在主页上,则为 X 提供服务,否则为 Y 提供服务.但是,我不完全确定如何进行测试.我不能只使用 URL,因为 url.com/和 url.com/index.php 和 url.com/index.php?等等等等都是有效的.
My thoughts are to throw in a little test in the index.php of the template: if we're at the homepage, serve X, otherwise, serve Y. However, I'm not entirely sure how to test this. I can't just use the URL because url.com/ and url.com/index.php and url.com/index.php? etc etc are all valid.
有谁知道做我想做的事情的方法吗?像 $_JOOMLA['page'] 变量或类似的方便的东西?
Does anyone know of a way to do what I'm trying to do? Like a $_JOOMLA['page'] variable or something convenient like that?
谢谢!--马拉
推荐答案
if(JRequest::getVar('view') == "frontpage" ) {
//You are in!
}
else {
//You are out!
}
这篇关于你如何测试你是否在 Joomla 的主页上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:你如何测试你是否在 Joomla 的主页上?


基础教程推荐
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 在多维数组中查找最大值 2021-01-01