Php 从Joomla 2.5组件访问机架/火箭主题模板参数
G'Day, 我有一个为Joomla 2.5设计的定制组件。目前我使用的是火箭血型模板。 我遇到的问题是,我在组件中的设计没有响应,因此在iphone/android等平台上看起来很糟糕 我是否有办法访问rockettheme/机架框架参数(从我的组件)以查看用户正在查看的布局。在大多数站点的底部,用户可以通过屏幕底部的桌面/移动按钮更改他们使用移动设备查看的布局。我想访问此设置。。。。并在my view.html.php文件中调整将显示的布局Php 从Joomla 2.5组件访问机架/火箭主题模板参数,php,joomla2.5,Php,Joomla2.5,G'Day, 我有一个为Joomla 2.5设计的定制组件。目前我使用的是火箭血型模板。 我遇到的问题是,我在组件中的设计没有响应,因此在iphone/android等平台上看起来很糟糕 我是否有办法访问rockettheme/机架框架参数(从我的组件)以查看用户正在查看的布局。在大多数站点的底部,用户可以通过屏幕底部的桌面/移动按钮更改他们使用移动设备查看的布局。我想访问此设置。。。。并在my view.html.php文件中调整将显示的布局 这可能吗?我一点也不知道从哪里开始…如果有人感兴趣
这可能吗?我一点也不知道从哪里开始…如果有人感兴趣,我设法创建了一个包括机架框架的解决方案,并访问机架cookie以确定用户正在查看的布局。(普通default.php文件或default_phone.php) 我们开始: 在view.html.php文件中:
//-----------------
// Add the Gantry framework and access the iphone switcher values!
//-----------------
$gantry_path = JPATH_SITE . '/libraries/gantry/gantry.php';
if (file_exists($gantry_path))
{
require_once($gantry_path);
}
else
{
echo "error " . JText::_('Unable to find Gantry library. Please make sure you have it installed.');
die;
}
global $gantry;
$prefix = 'viewswitcher-'.$gantry->get('template_prefix');
$cookiename = $prefix.$gantry->browser->platform.'-switcher';
$cookie = JRequest::getVar($cookiename, false, 'COOKIE', 'STRING');
if($cookie == true)
{
//User is viewing from iphone mode
$tpl = 'phone'; // this will call the layout file named: default_phone.php (It MUST be called default_xxx.php)
}
else{
//User is viewing from desktop - Do nothing! - view.html.php will call the normal default.php layout
}
//------------------------
// End Gantry Framework
//------------------------
所以我不确定这是正确的还是明智的方法,但它确实很有魅力