[英]Joomla 2.5 check current page
In Joomla 2.5 how would i check which page the user is currently on? 在Joomla 2.5中,我如何检查用户当前所在的页面? I have this which checks if they are on the home page:
我有这个检查它们是否在主页上:
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
I need something similar which will check if they are on another page in the site and return a different template. 我需要类似的东西来检查它们是否在网站的另一个页面上并返回一个不同的模板。 How would this be done?
怎么做?
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
if ($active->id == 139){
//some code
}
Joomla php check if user is viewing specific page. Joomla php检查用户是否正在查看特定页面。
There are several ways to differentiate your Front Page from other pages in your website. 有几种方法可以将首页与网站中的其他页面区分开来。
$active = JFactory::getApplication()->getMenu()->getActive(); $ active = JFactory :: getApplication() - > getMenu() - > getActive();
echo $active->alias; echo $ active-> alias;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.