【问题标题】:bullet points not appearing for each hyperlink每个超链接都没有出现项目符号
【发布时间】:2013-01-27 09:49:10
【问题描述】:

我的每个图片链接都假设以项目符号显示。问题是它只为所有图像链接显示一个项目符号,而不是为每个图像链接显示一个项目符号。我在我的 php/html 中做错了什么?

<table id="tableqanda" cellpadding="0" cellspacing="0">
    <thead>
    <tr>
        <th width="11%" class="image">Image</th>
    </tr>
    </thead>
    </table>
    <div id="tableqanda_onthefly_container">
    <table id="tableqanda_onthefly" cellpadding="0" cellspacing="0">
    <tbody>
    <?php

                function CreateLink($filename, $type){
 if($type == 'image'){
  return '<a href="previewimage.php?filename='.$filename.'" title="Click to view in New window" target="_blank">'.htmlspecialchars($filename).'</a>';
 }
}

          foreach ($arrQuestionId as $key=>$question) {
        echo '<tr class="tableqandarow">'.PHP_EOL;
        //start:procedure
        $img_result = '';
        if(empty($arrImageFile[$key])){
          $img_result = '&nbsp;';
        }else{
          $img_result .=  '<ul class="qandaul"><li>';
           if(is_array( $arrImageFile[$key] )){
            foreach($arrImageFile[$key] as $filename){
             $img_result.= CreateLink($filename, "image");
            }
           }else{
            $img_result.= CreateLink($arrImageFile[$key], "image");
           }
           $img_result.= '</li></ul>';
        }
        //end:procedure

        echo '<td width="11%" class="imagetd">'.$img_result.'</td>' . PHP_EOL;
        echo '</tr>'.PHP_EOL;

}

?>
    </tbody>
    </table>
    </div>

屏幕截图显示了它现在的样子:

【问题讨论】:

    标签: php html


    【解决方案1】:

    您可能希望每个链接都位于&lt;li&gt; 标记中:

    替换:

    $img_result.= CreateLink($filename, "image");
    

    与:

    $img_result.= '<li>' . CreateLink($filename, "image") . '</li>;
    // the other places where you use that function as well...
    

    并确保列表仅以 &lt;ul&gt; 标记开始和结束(而不是额外的 &lt;li&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-03
      • 2016-06-14
      • 2019-09-06
      • 2021-08-13
      相关资源
      最近更新 更多