如何测试您是否在Joomla的首页上? [英] How can you test if you're on the homepage in 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的首页上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!