Hello Everydrupal !
- I'm a Beginner with drupal, I have a problem with the theming because a footermap dont have a templete (footer.tpl.php for example) I want to create a footer map with a lot lists not one list !

Comments

mradcliffe’s picture

Category: task » support

I know that it is asking much of you, but can you follow git instructions and apply the patch in #637734: Footermap Theming: The Next Step. I do plan on switching how theming is done, but since it's a major change I need feedback.

You may take the render array and split it in the template file. Something like this would split out the first child element under a footermap menu header, and make new headers for each child (and their children underneath them). It's a little hard to explain. I'm sorry.

foreach (element_children($footermap['main-menu']) as $child) {
  $footermap['main-menu'][$child]['#theme'] = 'footermap_header';
  $new[] = $child;
}
print render($new);

Original render array:

  • main-menu
    • about
      • about me
      • contact
    • fish
      • salmon
      • tuna
    • car
      • honda
      • toyota

    would be rendered as this originally

    <h3>main menu</h3>
    <ul>
    <li>about</li><li>about me</li><li>contact</li><li>fish</li><li>salmon</li><li>tuna</li><li>car</li><li>honda</li><li>toyota</li>
    </ul>
    

    New render array:

    • about
      • about me
      • contact
    • fish
      • salmon
      • tuna
    • car
      • honda
      • toyota

    should be rendered as

    <h3>about</h3>
    <ul><li>about me</li><li>contact</li></ul>
    <h3>fish</h3>
    <ul><li>salmon</li><li>tuna</li></ul>
    <h3>car</h3>
    <ul><li>honda</li><li>toyota>/li></ul>
    
missiria’s picture

Thanks very much man ;) my salutations !

leanderl’s picture

First of all thanks for a great module!
I am using a main menu to create a list of all the menu-items in the footer.

I have a structure of

<main menu>
  <main category A>
    <sub page>
    <sub page>
  <main category B>
   <sub page>
   <sub page>
  <main category C>
    etc etc

I applied the patch and it helped me theme the main category X-items as a kind of header for the sub page:s. But I would also like to create columns. But I just cant get the above code to work even though it is clearly about the main-menu. When I insert it in in footermap.tpl.php the footermap simply disappears. Am i missing something obvious?

<?php  /* if (!empty($title)): ?>
    <h2><?php print check_plain($title); ?></h2>
  <?php endif; ?>

  <?php foreach ($footermap as $key => $header) { ?>
  <div id="<?php print 'footermap-col-' . $key; ?>" class="footermap-col">
    <?php print render($header); ?>
  </div>
  <?php } */ ?>
  <?php 
  /* From http://drupal.org/node/1195258 */
	 foreach (element_children($footermap['main-menu']) as $child) {
	  $footermap['main-menu'][$child]['#theme'] = 'footermap_header';
	  $new[] = $child;
	}
	print render($new); 
	?>

Ideally I would actually like to create a split every X items. Lets say every 8 items is enclosed i a new div. So that I can float columns of equal height horisontally.

mradcliffe’s picture

I will try to answer this as soon as I can. If I can't get to it today it might be several days as I will be out of town.

leanderl’s picture

Turns out I could achieve exactly what I wanted with the Menu-Block module and some CSS-styling. Other than the "divide after X items". But that idea lost it's appeal to me, since it is more logical and understandable for the user if columns are based on "main category"-items and their children. I'd love to do this with this module in future though, because the css-classes from menu-block are very general and you have style it like this. One would rather have classes more clearly and specificaly named to feel good about it.

.menu-block-wrapper ul.menu{
  text-align: left;
 } 	
.menu-block-wrapper ul.menu li.expanded{
  text-transform: uppercase;
  font-weight: bold;
  float:left;
  padding-right:20px;
}		
.menu-block-wrapper ul.menu li.expanded ul li {
  text-transform:none;
  font-weight: 100;
}
mradcliffe’s picture

Status: Active » Closed (fixed)

Closing issue.