Drupal primary links


/ Published in: PHP
Save to your folder(s)

Few different ways to output primary links in your page.tpl.php template.


Copy this code and paste it in your HTML
  1. <?php
  2. /**
  3.  * Option 1
  4.  *******************************************************/ ?>
  5.  
  6. <?php if (isset($primary_links)) : ?>
  7. <?php print theme('links', $primary_links, array('class' => 'links primary-links clear-block')) ?>
  8. <?php endif; ?>
  9.  
  10. <?php if (isset($secondary_links)) : ?>
  11. <?php print theme('links', $secondary_links, array('class' => 'links secondary-links clear-block')) ?>
  12. <?php endif; ?>
  13.  
  14.  
  15. <?php
  16. /**
  17.  * Option 2
  18.  *******************************************************/ ?>
  19.  
  20. <?php if (isset($primary_links)) { ?>
  21. <div id="primary-links">
  22. <?php print theme('menu_tree',variable_get('menu_primary_menu',0)); ?>
  23. </div>
  24. <?php } ?>
  25.  
  26.  
  27. <?php
  28. /**
  29.  * Option 3
  30.  *******************************************************/ ?>
  31.  
  32. <?php if (isset($primary_links)) {
  33. print theme('links', $primary_links, array('class' => 'links primary-links clear-block'));
  34. } ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.