The Primary/Secondary Link lists are started whether or not there are links to be displayed. This creates a validation error since unordered lists must contain items.

 26: <div id="top-nav">
 27: <ul id="primary">
 28: </ul>
 29:
 30: <ul id="secondary">
 31: </ul>
 32: </div>

In /themes/friendselectric/page.tpl.php

<div id="top-nav">
    <?php if (is_array($primary_links)): ?>
      <ul id="primary">
      <?php foreach ($primary_links as $link): ?>
        <li><?php print phptemplate_wrap_links($link, 2); ?></li>
      <?php endforeach; ?>
      </ul>
    <?php endif; ?>
    <?php if (is_array($secondary_links)): ?>
      <ul id="secondary">
      <?php foreach (array_reverse($secondary_links) as $link): ?>
        <li><?php print phptemplate_wrap_links($link, 2); ?></li>
      <?php endforeach; ?>
      </ul>
    <?php endif; ?>
  </div>

Is patched to --->

  <div id="top-nav">
    <?php if (is_array($primary_links) && !empty($primary_links)): ?>
      <ul id="primary">
      <?php foreach ($primary_links as $link): ?>
        <li><?php print phptemplate_wrap_links($link, 2); ?></li>
      <?php endforeach; ?>
      </ul>
    <?php endif; ?>
    <?php if (is_array($secondary_links) && !empty($secondary_links)): ?>
      <ul id="secondary">
      <?php foreach (array_reverse($secondary_links) as $link): ?>
        <li><?php print phptemplate_wrap_links($link, 2); ?></li>
      <?php endforeach; ?>
      </ul>
    <?php endif; ?>
  </div>

Patch is provided.

Let me know if something is wrong, since this is my first patch.

-Alan

P.S. Is there any reason the entire "top-nav" div shouldn't be displayed when there are no links? I didn't want to do this since I wasn't sure if it would break anything.

Comments

altano’s picture

Ugh, why can't I attach this patch? Let's try this again...

altano’s picture

Wow it just won't let me attach this patch!

Warning: htmlspecialchars() expects parameter 1 to be string, object given in /home/www/drupal.org/includes/common.inc on line 571

Warning: htmlspecialchars() expects parameter 1 to be string, object given in /home/www/drupal.org/includes/common.inc on line 571

Warning: Cannot modify header information - headers already sent by (output started at /home/www/drupal.org/includes/common.inc:571) in /home/www/drupal.org/includes/common.inc on line 208

Here is a link to it off my site:
http://www.terriblefish.com/files/page_tpl_php_patch.txt

If someone could d/l it, rename it, and upload it, that would be cool (or tell me what i'm doing wrong).

Steven’s picture

Fixed in HEAD and 4.6. About the upload problems, it wasn't your fault, there was a problem with a recent patch to CVS which caused problems with the drupal.org set up. It should be fixed now.

Anonymous’s picture