0

問題が発生しています

$divider_div = ($last_topic % 2 == 0) ? '
<div class="clear"></div>' : FALSE ;

それは毎秒発生するたびに配置する必要がありますが、代わりに何らかの形でシーケンスを中断します。

私が間違っていることは何ですか?

どんな提案でも大歓迎です

これが私のスクリプトです

$category_topic_query = 'SELECT l.category_name, l.category_folder, l.category_page, f.parentpageID, f.ImagePath, f.referring_url, f.templateTitle FROM lcategories l INNER JOIN Files f ON f.parentpageID = l.ID WHERE f.pageID = "0" ORDER BY f.parentpageID';
    $resc = $db->prepare($category_topic_query);
    $resc->execute();
$last_topic = NULL;
while ($category_topic = $resc -> fetch()){
    $category_topic_ID = $category_topic['parentpageID'];
    if($category_topic_ID !== $last_topic) {
    $category_topic_name = str_replace("&", "&amp;", $category_topic['category_name']);
    $category_topic_url = DST.$category_topic['category_folder'].DS.$category_topic['category_page'];
    $divider_div = ($last_topic % 2 == 0) ? '
<div class="clear"></div>' : FALSE ;
    $first_ul = ($category_topic_ID == 1) ? FALSE : '</ul>
</div>'.$divider_div ;
print<<<END
$first_ul
<div style="float: left; margin: 10px; width: 349px;">
<h2 class="h_unln"><a href="$category_topic_url">$category_topic_name</a></h2>
<ul class="arrow">

END;

$last_topic = $category_topic_ID;
}
    $links_array = ($category_topic['referring_url'] == NULL) ? FALSE :'<li><a href="'.DST.$category_topic['ImagePath'].DS.$category_topic['referring_url'].'">'.$category_topic['templateTitle'].'</a></li>';


print<<<END
$links_array

END;
}
print<<<END
</ul>
</div>
<div class="clear"></div>

END;

前もって感謝します

4

1 に答える 1

0

OK、それは完了し、期待どおりに動作します

    $category_topic_query = 'SELECT l.category_name, l.category_folder, l.category_page, f.parentpageID, f.ImagePath, f.referring_url, f.templateTitle FROM lcategories l INNER JOIN Files f ON f.parentpageID = l.ID WHERE f.pageID = "0" ORDER BY f.parentpageID';
    $resc = $db->prepare($category_topic_query);
    $resc->execute();
$last_topic = NULL;
$add_rowNum = 1;
while ($category_topic = $resc -> fetch()){
    $category_topic_ID = $category_topic['parentpageID'];
    if($category_topic_ID !== $last_topic) {
        $add_rowNum++;
    $category_topic_name = str_replace("&", "&amp;", $category_topic['category_name']);
    $category_topic_url = DST.$category_topic['category_folder'].DS.$category_topic['category_page'];
    $divider_div = ($add_rowNum % 2 == 0) ? '
<div class="clear"></div>' : FALSE ;
    $first_ul = ($category_topic_ID == 1) ? FALSE : '</ul>
</div>'.$divider_div ;
print<<<END
$first_ul
<div style="float: left; margin: 10px; width: 349px;">
<h2 class="h_unln"><a href="$category_topic_url">$category_topic_name</a></h2>
<ul class="arrow">

END;

$last_topic = $category_topic_ID;
}
    $links_array = ($category_topic['referring_url'] == NULL) ? FALSE :'<li><a href="'.DST.$category_topic['ImagePath'].DS.$category_topic['referring_url'].'">'.$category_topic['templateTitle'].'</a></li>';


print<<<END
$links_array

END;
}
print<<<END
</ul>
</div>
<div class="clear"></div>

END;

私の間違いは、実際に$add_rowNum++;間違った場所に追加していたことです

CBroe のおかげで、ID について非常に重要なことを 1 つ認識できました。

于 2013-09-14T20:26:24.737 に答える