Recent Topics

display_list has a problem

started by on Nov 06, 2006 – Last touched: Nov 06, 2006

Nov 06, 2006 10:55    

display_list() has the following line

Code

echo '<a href="'.$item[0].'">'.$item[1].'</a></li>';

which should be

Code

echo '<a href="'.$item[0].'">'.$item[1].'</a>';

Nov 06, 2006 15:26

In what path/to/what/file will I find this undesirable /li tag, and do you know where it's opener is so that one bug squash won't generate another?

Nov 06, 2006 18:55

line 2963,of /blogs/inc/_misc/_misc.funcs.php ( figured you would know how to search multiple files for 'function display_list' EdB ;) )

Code

/**
* Display an array as a list:
*/
function display_list( $items, $list_start = '<ul>', $list_end = '<ul>', $item_separator = '', $item_start = '<li>', $item_end = '</li>' )
{
  if( !empty( $items ) )
  {
    echo $list_start;
    $first = true;
    foreach( $items as $item )
    {
      if( $first )
      {
        $first = false;
      }
      else
      {
        echo $item_separator;
      }
      echo $item_start;
      if( is_array( $item ) )
      {
        echo '<a href="'.$item[0].'">'.$item[1].'</a></li>';
      }
      else
      {
        echo $item;
      }
      echo $item_end;
    }
    echo $list_end;
  }
}

As you can see, if the user wants to output them with <li>s it is done via $item_end; so the above would cause a excess </li> when $list_end = '</li>', as well as a uneeded </li> when users don't even want to display it with li tags.

Nov 06, 2006 23:34

Cool. I was either being lazy or helpful to those unhip to groovy search tools. BTW Agent Ransack has become one of my favorite utilities.

Nov 07, 2006 00:34

;) Yeh it was mine as well, until blueyed told me that dreamweaver has the feature inbuilt 8|

Nov 07, 2006 00:55

Yup, until my computer with my "free trial forever" copy blew up :(

Nov 07, 2006 09:31

I'll be darned. I knew there was a previous case of an extra li and /li, but I kinda thought this was another one. Oh well eh?


Form is loading...

blog tool – This forum is powered by b2evolution CMS, a complete engine for your website.