[themes] Replicating page.tpl.php in D7

Jeff Greenberg listmail.ayendesigns at gmail.com
Sun Sep 9 23:13:33 UTC 2012


I have the following code in my module in D7. My intention is to have my
custom template loaded in place of page.tpl.php for this specific page, and
to have the template file in the module directory rather than having
page--mypage.tpl.php in the theme directory.

The problem I'm running in to is that after the template is loaded, it
complains that none of the page variables (logo, etc) exist. I realize that
my arguments array is empty in the code, but in looking around (in all the
wrong places, apparently) I can't figure out what to pass.

function mymodule_user_dashboard_menu() {
  $items = array();

  $items['dashboard/%user_uid_optional'] = array(
    'page callback' => '_mymodule_user_dashboard_template',
    'page arguments' => array(1),
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );

  return $items;
}

function _mymodule_user_dashboard_template() {
  return theme('mymodule_user_dashboard_template');
}

function mymodule_user_dashboard_theme() {
  $themes = array(
    'mymodule_user_dashboard_template' => array(
      'template' => 'templates/dashboard',
      'arguments' => array(),
    )
  );

  return $themes;
}

-- 
---
drupal.org/user/367108
linkedin.com/in/jeffrgreenberg
accidentalcoder.com / ayendesigns.com
@accidentalcoder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/themes/attachments/20120909/a7bb9aa0/attachment.html 


More information about the themes mailing list