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 的主页上?
基础教程推荐
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
