1

Hotelscombined(hotel information site) asked me "the header part" of my website so they can combine my website's header and their hotel list. My header part will be placed in their site.

Then it looks that my website services hotel information. My site is developed using Drupal 7. How can I get header part only? It shouldn't be just copying and pasting. It should be something like link. With that, it will be affected in Hotelscombined, even if I changed header part of my website like main menu.

enter image description here

Please help me.

3
  • Welcome to Drupal Answers :) Currently this makes no sense and needs to be closed. Also, please bear in mind that we don't answer questions asking how to implement a screenshot or off-site layout, as they don't make useful questions for our Q+A repository. Please see the help center for more information about what questions to ask here, and the level of detail you need to show. Thanks
    – Clive
    Aug 6 '14 at 9:40
  • I didn't ask about layout. I'm just asking how to extract the header code from my drupal web site dynamically.
    – argenhong
    Aug 8 '14 at 6:01
  • In that case it's too broad currently - you haven't described how the header of your website is implemented, nor the format/mechanism you're going to use to 'extract' the header to the other site. If you're having issues that require coding, we need to see the code you're using and descriptions of what's going wrong (writing code from scratch is something we explicitly don't do here as it encourages poor questions)
    – Clive
    Aug 8 '14 at 9:56
1

Usually header part is included in drupal in page.tpl.php.

Still you can do it by creating a function in your template.php

e.g. myheader() and calling it in page.tpl.php.

function myheader(){
$html = "<div class='header'>
 Insert header html
</div>";
return $html;

}  

Other way you create a template using hook_theme in your custom module and call it in page.tpl.php.

e.g. it will be called in page.tpl.php by below code

print theme('myheader'); 

//It will defined in custom module 


function mymodule_theme($existing, $type, $theme, $path)
{
  if($type == 'module')
  {
    return array(
      'myheader' => array(
        'variables' => array('var_name'=>NULL),
        'template' => 'myheader'
      ),
    );
  }
  return array(); //will raise fatal error if void
}

and put a template in theme directory with name myheader.tpl.php

Hope it will help!

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.