English 中文(简体)
Drupal 7模块(移动工具)中的主题转换
原标题:Switching Themes in Drupal 7 module (mobile tools)
  • 时间:2011-03-01 07:42:12
  •  标签:
  • drupal-7

I ve been trying to get mobile_tools for Drupal 7 to work but it appears it s not switching themes. (Or at least I can t get it to switch).

这是“负责改用移动主题”的法典。 如果我印刷tom——主题确实成为流动主题的名称,但所展示的主题仍然是不实的。 我未能找到任何关于可变的cus子——至少不是第7博士的话题的文件。

/**
 * Being called in the hook_boot() implementation
 * This function is in charge of changing to the mobile theme
 */
function mobile_tools_switch_theme($device) {
 global $custom_theme, $conf;
 // check if theme switching is forced
 $current_url_type = mobile_tools_is_mobile_site();

 if (($current_url_type ==  mobile  &&  variable_get( mobile-tools-theme-switch ,     ) ==  mobile-tools-mobile-url ) || 
   (variable_get( mobile-tools-theme-switch ,     ) ==  mobile-tools-mobile-device  && $device[ type ]  ==  mobile ) ) {
  $group = $device[ group ];
  $mobile_detection_module = variable_get( mobile-tools-device-detection ,  mobile_tools );
  if (variable_get($mobile_detection_module .  _  . $group .  _enable ,   ) == 1) {
   $custom_theme = variable_get($mobile_detection_module .  _  . $group .  _theme , $conf[ theme_default ]);
   return TRUE;
  }
  else {
   $custom_theme  = variable_get( mobile_tools_theme_name , $conf[ theme_default ]);
   return TRUE;
  }
 }
 return FALSE;
}
最佳回答

中提及的将主题移至第7博士的道路已久。 升级模块从6.x到7.x 页: 1 或具体指明一条“条码”


Example from the updown page :

<?php
/**
* Implements hook_menu_alter().
*/
function mymodule_menu_alter(&$items) {
  // Set the theme callback function for all node pages. As per the
  // standard behavior for hook_menu() properties, this will be
  // inherited by all paths underneath node/%node as well, unless
  // they define their own theme callback.
  $items[ node/%node ][ theme callback ] =  mymodule_default_node_theme ;

  // Set a different theme callback for node edit pages, and pass
  // along the node object to this function so we can make decisions
  // based on it.
  $items[ node/%node/edit ][ theme callback ] =  mymodule_edit_node_theme ;
  $items[ node/%node/edit ][ theme arguments ] = array(1);
}

/**
* Defaults to using the  some_theme  theme for node pages.
*/
function mymodule_default_node_theme() {
  return  some_theme ;
}

/**
* For editing page nodes, uses the  some_other_theme  theme.
*/
function mymodule_edit_node_theme($node) {
  return $node->type ==  page  ?  some_other_theme  : mymodule_default_node_theme();
}

/**
* Implements hook_custom_theme().
*/
function mymodule_custom_theme() {
  global $user;
  // If the current user has a special role assigned to them, then display all
  // pages of the site (including those listed above) using the  special_theme 
  // theme.
  if (in_array(variable_get( mymodule_special_role , 0), array_keys($user->roles))) {
    return  special_theme ;
  }
}
?>
问题回答

暂无回答




相关问题
Which version of drupal should I study, 6 or 7?

I have been planning to try to build a shopping store with Drupal 7 just for fun and have been studying it for a few days now. But with its current status(alpha5), I doubt if my time and effort would ...

Custom theming for content type in Drupal

I can apply a custom theme to a certain content type in Drupal by copying the node.tpl.php file and placing the name of my content type right after the "node" in the file name and appending an hyphen. ...

Build a new Drupal site using D7 [closed]

I m planning to rebuild a site I ve got, from self-hacked to Drupal. I m planning to dive in to Drupal and later on work as a freelancer (using Drupal). And here s my question. After spending some ...

Drupal pass argument to page

I have a custom Drupal module displaying some data in a table. Each row has a link which if clicked will delete the relevant row. Specifically, when the link is clicked it will take the user to a ...

Drupal 7 Install Error

I was hoping that someone can shed some light on why I am getting this error: Parse error: syntax error, unexpected { in /homepages/22/d223624283/htdocs/drupal_new/includes/install.core.inc on ...

URL alias for language frontpage

I have set Drupal to determine the language from the URL (path prefix), thus / is english and /da is Danish. This works fine for all pages except /da The frontpage for Danish is /node/14 but it ...

Has anyone checked out Drupal 7? [closed]

Has anyone checked out a copy of Drupal 7 yet? What do people think? I m pretty excited about the PDO and all of the designers I work with a very excited about the new admin interface/structure. Do ...

热门标签