我现在正在为一个客户建立一个模板,希望在joomla的一个实例下有多个微站点和一个主站点。我在Joomla中构建它,因为这是我所知道的,所以请不要建议另一个CMS,是的,我知道Drupal内在地支持它!这就是skinny。现在,我的模板从模板参数中查找域名,然后将其与基本URI进行比较,然后设置要在整个模板中使用的变量。所以代码是这样的.
//multisite configuration - determines which template params and menu module to display depending on the base URL
$url = JURI::base();
$primary = 'http://'.$this->params->get('site-domain').'/';
$sub1= 'http://'.$this->params->get('domain1-domain').'/';
$sub2= 'http://'.$this->params->get('domain2-domain').'/';
$sub3= 'http://'.$this->params->get('domain3-domain').'/';
$sub4= 'http://'.$this->params->get('domain4-domain').'/';
$sub5= 'http://'.$this->params->get('domain5-domain').'/';
if($url == $primary):
$logo = $this->params->get('logo');
$title = $this->params->get('site-title');
$slogan = $this->params->get('site-slogan');
$menu = '<jdoc:include type="modules" name="menu" />';
elseif($url == $sub1):
$logo = $this->params->get('domain1-logo');
$title = $this->params->get('domain1-title');
$slogan = $this->params->get('domain1-slogan');
$menu = '<jdoc:include type="modules" name="menu-1" />';
elseif($url == $sub2):
$logo = $this->params->get('domain2-logo');
$title = $this->params->get('domain2-title');
$slogan = $this->params->get('domain2-slogan');
$menu = '<jdoc:include type="modules" name="menu-2" />';
elseif($url == $sub3):
$logo = $this->params->get('domain3-logo');
$title = $this->params->get('domain3-title');
$slogan = $this->params->get('domain3-slogan');
$menu = '<jdoc:include type="modules" name="menu-3" />';
elseif($url == $sub4):
$logo = $this->params->get('domain4-logo');
$title = $this->params->get('domain4-title');
$slogan = $this->params->get('domain4-slogan');
$menu = '<jdoc:include type="modules" name="menu-4" />';
elseif($url == $sub5):
$logo = $this->params->get('domain5-logo');
$title = $this->params->get('domain5-title');
$slogan = $this->params->get('domain5-slogan');
$menu = '<jdoc:include type="modules" name="menu-5" />';
endif;因此,现在我需要做的是构建一个模板参数来确定哪个菜单项ID是默认菜单项,然后执行PHP标头重定向。由于Joomla不支持多个默认值,因此我需要一个变通方法来生成必要的重定向URL。我想通过菜单项id或别名,因为我不想被限制在一个类别或文章类型的显示。不幸的是,解决这个问题是我的PHP和Joomla知识不足的地方。任何帮助都是最好的。
谢谢Sandra :)
发布于 2013-06-22 10:55:48
相反,您可以使用Virtual Domains之类的扩展,它允许您将不同的域与不同的默认菜单项相关联。然后,您可以使用标准的Joomla模板,并以菜单为基础分配它们。
https://stackoverflow.com/questions/17238792
复制相似问题