Hello, everyone!
I am new to Drupal.
I have created a new theme, called Tutorial Theme, and I am trying to make a dropdown menu in the HEADER region. But the new Menu does not appear on the website. Also, how can I insert HTML code into regions using the DRUPAL GUI?

Can somebody help me?

Comments

ann.onimus07’s picture

This is the page.tpl.php:

<!-- All regions (Header, Sidebars, Content, Footer) go inside this division -->
<div id="wrapper">

<!-- This is the HEADER region. See Tutorial_Theme_Style.css file -->
	<div id="header"> <br><br>This is the HEADER region
		<!--start logo-->
		<div id="logo">
			<?php if ($logo): ?>
			<a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>">
			<img src="<?php print $logo; ?>" alt="<?php print t('Home'); ?>" />
			</a>
			<?php endif; ?>
		</div>
 		<!--end logo-->
 		
 		<div id="main_menu">
     		<?php if ($main_menu): ?>
      		<?php print theme('links', $main_menu); ?>
     		<?php endif; ?>
		</div>
	</div>

<!-- This is the SIDEBAR_FIRST region. See Tutorial_Theme_Style.css file -->  
   <div id="sidebar_first"> <br><br>This is the SIDEBAR_FIRST region
      <?php if ($page['sidebar_first']): ?>
        <?php print render($page['sidebar_first']); ?>
      <?php endif; ?>
   </div>  

<!-- This is the CONTENT region. See Tutorial_Theme_Style.css file --> 
   <div id="content"> <br><br>This is the CONTENT region
    <?php print render($title_prefix); ?>
      <?php if ($title): ?><h1><?php print $title; ?></h1><?php endif; ?>
    <?php print render($title_suffix); ?>

    <?php print render($messages); ?>
    <?php if ($tabs): ?><div class="tabs"><?php print render($tabs); ?></div><?php endif; ?>
    <?php if ($action_links): ?><ul class="action-links"><?php print render($action_links); ?></ul><?php endif; ?>

    <?php print render($page['content']); ?>
   </div>

<!-- This is the SIDEBAR_SECOND region. See Tutorial_Theme_Style.css file -->    
    <div id="sidebar_second"> <br><br>This is the SIDEBAR_SECOND region
      <?php if ($page['sidebar_second']): ?>
        <?php print render($page['sidebar_first']); ?>
      <?php endif; ?>
    </div>  

<!-- This is the FOOTER region. See Tutorial_Theme_Style.css file -->
  <div id="footer"> <br><br>This is the FOOTER region
    <?php if ($page['footer']): ?>    
      <?php print render($page['footer']); ?>
    <?php endif; ?>  
  </div>

</div>

This is the .info file:

name = Tutorial_Theme
core = 7.x
engine = phptemplate
screenshot = screenshot.png
regions[header]= Header
regions[sidebar_first] = Left sidebar
regions[sidebar_second] = Right sidebar
regions[content] = Content
regions[footer] = Footer
stylesheets[all][] = css/Tutorial_Theme_Style.css
yelvington’s picture

features[] = main_menu
; and if you want a secondary menu, add
features[] = secondary_menu

As for adding html to regions through the UI, create a custom block that can be assigned to your region, and be sure to set the input filter appropriately.

ann.onimus07’s picture

Thank you for your fast reply.

1)How to create a custom block through the UI? Or do you mean another HTML division in the page.tpl.php?
2)What do you mean by input filter?

yelvington’s picture

How to create a custom block through the UI?

On the blocks page, of course.

What do you mean by input filter?

All Drupal output is filtered. It's called an "input filter" because the "input" (which was stored in its raw form) is being filtered. Input filter settings are not hard to find if you click on "configuration" in the UI.

ann.onimus07’s picture

PHP code was not right.

WRONG code:

<div id="main_menu">
    <?php if ($main_menu): ?>
         <?php print theme('links', $main_menu); ?>
     <?php endif; ?>
</div>



CORRECT code:

<div id="main-menu" class="navigation">
    <?php if ($main_menu): ?>
        <?php print theme('links__system_main_menu', array('links' => $main_menu, 'attributes' => array('id' => 'main-menu', 'class' => array('links', 'inline', 'clearfix')), 'heading' => t('Main menu'))); ?>
    <?php endif; ?>
</div>

NOTE:
You CAN place the Menu in whatever region you want by adding this code to that specific region in your page.tpl.php

More details here HERE