需要具有相同主题的相同DB的重复Drupal 7站点,有什么建议吗?

问题描述 投票:0回答:1

我们在根域上有一个Drupal 7网站,希望建立一个具有相同内容但没有页眉/页脚品牌的子域或子目录,以便我们的合作伙伴可以将我们产品部分的iframe添加到其网站中。我们需要使用相同的数据库,以便所有内容都在全球范围内更新。

关于从哪里开始的任何建议?感谢您的帮助。

谢谢

php drupal drupal-7
1个回答
0
投票

您可以使用自定义模块以编程方式更改主题

function MYMODULE_menu(){
  $items = array();
  $items['myendpoint/path/%'] = array(
    'title'            => 'Custom rendering page external',
    'page callback'    => 'custom_rendering_on_endpoint',
    'page arguments'   => array(2),
    'access arguments' => array('access content'),
    'type'             => MENU_CALLBACK,
  );
  return $items;

}


function custom_rendering_on_endpoint($nid = null)

  $node = node_load($nid);
  $view = node_view($node, 'full');
  print drupal_render($view);
}

function  MYMODULE_custom_theme(){
   $menu = menu_get_item();
   if($menu['path'] == 'myendpoint/path/%'){
       return "custom_theme_name";
   }
   return "default_theme_name";  
}

注意:更改page.tpl.php以删除您不想在自定义主题中显示的所有区域和部分($ header,$ footer等。)

应注意,您要激活的主题必须首先在admin / appearance启用。

文档:https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_custom_theme/7.x

© www.soinside.com 2019 - 2024. All rights reserved.