问题描述
我在 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 的主页上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!