I'm building a custom template for block.tpl.php . My code is like this:

<div id="<?php print $block->module . '-' . $block->delta; ?>" class="box block-<?php print $block->module; ?>">
  <h3><?php print $block->subject; ?></h3>
  <p>
    <?php print $block->content; ?>
  </p>     
</div>

But then the output for the navigation menu on the sidebar is like this:

<div class="box block-user" id="user-1">
<h3>admin</h3>
<p>
</p>
<ul class="menu"><li class="leaf first"><a href="/drupal/user/1">My account</a></li>
<li class="collapsed"><a href="/drupal/node/add">Create content</a></li>
<li class="collapsed"><a href="/drupal/admin">Administer</a></li>
<li class="leaf last"><a href="/drupal/logout">Log out</a></li>
</ul>       
</div>

The ul list for the menu items are outside of the

element. I really don't know why. If I change

to

then ul is correctly located inside the div.

Is there any solution to this (instead of changing p to div?)

Thank you.

Gary.

Comments

caole261188’s picture

Sorry I forgot to enclose the code inside <code> tag:

If I change
<p>
to
<div class="content">
then ul is correctly located inside the div. "

caole261188’s picture

Could anyone help me please?

Jeff Burnz’s picture

You don't mention what your doc type is but your UL inside the P tag is invalid markup for XHTML Strict.

Use the div, its what they are for - demarcating divisions of logically grouped elements, like a list.