Home | ArchiveList | Category | About
Home > PC > Nucleus > NP_ShowBlogs 2.7
http://japan.nucleuscms.org/bb/viewtopic.php?p=15432#15432

doIf対応バージョンで、表示されているページ数を判定できるようになってます。同一日でも日付ヘッダが毎回出る件などがあって今まで移行してなかったんですが、フォーラムで修正方法を教えていただいたので移行してみました。修正内容などは以下になります。
日付ヘッダが連続する件ですが、まずはプラグイン本体ではなく、BLOG.phpの方を下記のように $old_date = 0; の場所を移動させます。

    //20070507_takehana_moved↓
$old_date = 0;

// loop over all items
while ($item = mysql_fetch_object($items)) {

$item->timestamp = strtotime($item->itime); // string timestamp -> unix timestamp

// action handler needs to know the item we're handling
$actions->setCurrentItem($item);

// add date header if needed
//20070507_takehana_moved↑
//$old_date = 0;


これだけだと最初の記事だけは日付ヘッダが連続するので、今度はプラグインファイルの下記部分をコメント化します。なお、2.6以降で増えたオプションの広告挿入に関するところなので、不要な人だけコメント化を推奨します。

/* 20070508_takehana_com_s
global $catid;
$onlyone_query = $showQuery . ' LIMIT ' . intval($q_startpos) .', 1';
$b->showUsingQuery($template, $onlyone_query, 0, 1, 1);
if (intval($ads) == 0 && $this->showAdCode > 0) {
echo $this->getOption('ads');
// }
//------------SECOND AD CODE-------------
} elseif (intval($ads) == 1 && $this->showAdCode > 0) {
echo $this->getOption('ads2');
}
$q_startpos++;
$q_amount--;
if ($q_amount <= 0) return;
$onlyone_query = $showQuery . ' LIMIT ' . intval($q_startpos) . ', 1';
$b->showUsingQuery($template, $onlyone_query, 0, 1, 1);
if (mysql_num_rows(sql_query($onlyone_query)) && empty($ads) && $this->showAdCode > 0) {
echo $this->getOption('ads2');
}
//------------SECOND AD CODE END-------------
$q_startpos++;
$q_amount--;
if ($q_amount <= 0) return;
20070508_takehana_com_e */


デフォルト状態のモード3でのページスイッチ表示を、ちょっと自分好みに変更します。最初のページ、最後のページの時にはPrevとかNextとか出さないようにしたり、ページ区切り文字をピリオドにしたり、縦線の間が広いのを狭くしたり一本にしたり、といった感じにするため下記場所を修正しました。

        $buf .= '<a href="' . $prevpagelink . '" title="Previous page" rel="Prev">'
//20070508_takehana_com1_add1
// . '<span class="npsb_prevlink">' . $prevLinkLabel . '</span></a> |';
. '<span class="npsb_prevlink">' . $prevLinkLabel . '</span></a> ';
} elseif ($type >= 2) {
//20070508_takehana_com1_add1
// $buf .= $prevLinkLabel . " |";


                $buf  = rtrim($buf);
//20070508_takehana_com1_add1
//$buf .= "...|\n";
$buf .= "... \n";
}
} else {
$buf .= ' <a href="' . $i_pagelink . '" title="Page No.' . $i . '">'
//20070508_takehana_com1_add1
//. $i . '</a> |' . "\n";
. $i . '</a> | '."\n";


      if (intval($type) == 3) {
$buf .= '|';
//20070508_takehana_com1_add1
// $sepstr = '&middot;';
$sepstr = ' . ';


            $buf = rtrim($buf);
$buf = preg_replace('/$sepstr$/', '', $buf);
//20070508_takehana_com1_add1
// $buf .= "... |\n";
$buf .= "... \n";


//20070508_takehana_com1_add1
// $buf .= '| <a href="' . $nextpagelink . '" title="Next page" rel="Next">'
$buf .= '| <a href="' . $nextpagelink . '" title="Next page" rel="Next">'
. '<span class="npsb_nextlink">' . $nextLinkLabel . '</span></a>' . "\n";
} elseif ($type >= 2) {
//20070508_takehana_com1_add1
// $buf .= "| " . $nextLinkLabel . "\n";
$buf .= "| " . "\n";


修正前

1page

2page

6page

112page

修正後

1page

2page

6page

112page

微妙に変わってるのが分かると思います。


この記事へのコメント
Please JavaScript ON for comment. %3c%61%20%69%64%3d%22%6e%75%63%6c%65%75%73%5f%63%66%22%3e%3c%2f%61%3e %3c%66%6f%72%6d%20%6d%65%74%68%6f%64%3d%22%70%6f%73%74%22%20%61%63%74%69%6f%6e%3d%22%23%6e%75%63%6c%65%75%73%5f%63%66%22%3e %09%3c%69%6e%70%75%74%20%74%79%70%65%3d%22%68%69%64%64%65%6e%22%20%6e%61%6d%65%3d%22%61%63%74%69%6f%6e%22%20%76%61%6c%75%65%3d%22%61%64%64%63%6f%6d%6d%65%6e%74%22%20%2f%3e %09%3c%69%6e%70%75%74%20%74%79%70%65%3d%22%68%69%64%64%65%6e%22%20%6e%61%6d%65%3d%22%75%72%6c%22%20%76%61%6c%75%65%3d%22%69%6e%64%65%78%2e%70%68%70%3f%69%74%65%6d%69%64%3d%32%31%31%38%26%61%6d%70%3b%63%61%74%69%64%3d%34%32%22%20%2f%3e %09%3c%69%6e%70%75%74%20%74%79%70%65%3d%22%68%69%64%64%65%6e%22%20%6e%61%6d%65%3d%22%69%74%65%6d%69%64%22%20%76%61%6c%75%65%3d%22%32%31%31%38%22%20%2f%3e %09 %09%09%3c%64%69%76%20%63%6c%61%73%73%3d%74%72%61%63%6b%62%61%63%6b%69%6e%66%6f%3e %09%09%09%3c%6c%61%62%65%6c%20%66%6f%72%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%6e%61%6d%65%22%3e%4e%61%6d%65%3a%3c%2f%6c%61%62%65%6c%3e %09%09%3c%2f%64%69%76%3e %09%09%3c%69%6e%70%75%74%20%6e%61%6d%65%3d%22%75%73%65%72%22%20%73%69%7a%65%3d%22%34%30%22%20%6d%61%78%6c%65%6e%67%74%68%3d%22%34%30%22%20%76%61%6c%75%65%3d%22%22%20%63%6c%61%73%73%3d%22%66%6f%72%6d%66%69%65%6c%64%22%20%69%64%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%6e%61%6d%65%22%20%2f%3e %09%09%3c%64%69%76%20%63%6c%61%73%73%3d%74%72%61%63%6b%62%61%63%6b%69%6e%66%6f%3e %09%09%09%3c%6c%61%62%65%6c%20%63%6c%61%73%73%3d%22%6c%61%62%65%6c%6e%61%6d%65%22%20%66%6f%72%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%6d%61%69%6c%22%3e%55%52%4c%3a%3c%2f%6c%61%62%65%6c%3e %09%09%3c%2f%64%69%76%3e %09%09%3c%69%6e%70%75%74%20%6e%61%6d%65%3d%22%75%73%65%72%69%64%22%20%73%69%7a%65%3d%22%34%30%22%20%6d%61%78%6c%65%6e%67%74%68%3d%22%36%30%22%20%76%61%6c%75%65%3d%22%22%20%63%6c%61%73%73%3d%22%66%6f%72%6d%66%69%65%6c%64%22%20%69%64%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%6d%61%69%6c%22%20%2f%3e %09%09%3c%64%69%76%20%63%6c%61%73%73%3d%74%72%61%63%6b%62%61%63%6b%69%6e%66%6f%3e %09%09%09%3c%6c%61%62%65%6c%20%63%6c%61%73%73%3d%22%6c%61%62%65%6c%6e%61%6d%65%22%20%66%6f%72%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%65%6d%61%69%6c%22%3e%4d%61%69%6c%3a%3c%2f%6c%61%62%65%6c%3e %09%09%3c%2f%64%69%76%3e %09%09%3c%69%6e%70%75%74%20%6e%61%6d%65%3d%22%65%6d%61%69%6c%22%20%73%69%7a%65%3d%22%34%30%22%20%6d%61%78%6c%65%6e%67%74%68%3d%22%31%30%30%22%20%76%61%6c%75%65%3d%22%22%20%63%6c%61%73%73%3d%22%66%6f%72%6d%66%69%65%6c%64%22%20%69%64%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%65%6d%61%69%6c%22%20%2f%3e %09%09%3c%64%69%76%20%63%6c%61%73%73%3d%74%72%61%63%6b%62%61%63%6b%69%6e%66%6f%3e %09%09%09%3c%6c%61%62%65%6c%20%63%6c%61%73%73%3d%22%6c%61%62%65%6c%6e%61%6d%65%22%20%66%6f%72%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%62%6f%64%79%22%3e%43%6f%6d%6d%65%6e%74%3a%3c%2f%6c%61%62%65%6c%3e %09%09%3c%2f%64%69%76%3e %09%09%3c%74%65%78%74%61%72%65%61%20%6e%61%6d%65%3d%22%62%6f%64%79%22%20%20%63%6c%61%73%73%3d%22%63%6f%6d%6e%61%6d%65%22%20%63%6f%6c%73%3d%22%35%35%22%20%72%6f%77%73%3d%22%31%30%22%20%69%64%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%62%6f%64%79%22%3e%3c%2f%74%65%78%74%61%72%65%61%3e %09%09%3c%62%72%2f%3e%3c%69%6e%70%75%74%20%74%79%70%65%3d%22%63%68%65%63%6b%62%6f%78%22%20%6e%61%6d%65%3d%22%6e%6f%74%73%70%61%6d%22%20%76%61%6c%75%65%3d%22%32%31%31%38%22%20%69%64%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%73%70%61%6d%22%20%63%68%65%63%6b%65%64%3d%22%63%68%65%63%6b%65%64%22%20%2f%3e%3c%6c%61%62%65%6c%20%66%6f%72%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%73%70%61%6d%22%3eチェックを外してください%3c%2f%6c%61%62%65%6c%3e %3c%69%6e%70%75%74%20%74%79%70%65%3d%22%68%69%64%64%65%6e%22%20%6e%61%6d%65%3d%22%74%69%6d%65%72%22%20%76%61%6c%75%65%3d%22%31%35%37%31%35%36%30%32%35%30%22%20%69%64%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%74%69%6d%65%72%22%20%2f%3e %09%09%3c%62%72%20%2f%3e%3c%62%72%20%2f%3e %09%09%3c%69%6e%70%75%74%20%74%79%70%65%3d%22%63%68%65%63%6b%62%6f%78%22%20%76%61%6c%75%65%3d%22%31%22%20%6e%61%6d%65%3d%22%72%65%6d%65%6d%62%65%72%22%20%69%64%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%72%65%6d%65%6d%62%65%72%22%20%20%2f%3e %09%09%3c%6c%61%62%65%6c%20%66%6f%72%3d%22%6e%75%63%6c%65%75%73%5f%63%66%5f%72%65%6d%65%6d%62%65%72%22%3e%53%61%76%65%20%59%6f%75%72%20%49%6e%66%6f%3c%2f%6c%61%62%65%6c%3e %09%09%3c%62%72%20%2f%3e %09%09%3c%69%6e%70%75%74%20%74%79%70%65%3d%22%73%75%62%6d%69%74%22%20%61%6c%74%3d%22%41%64%64%20%43%6f%6d%6d%65%6e%74%22%20%76%61%6c%75%65%3d%22%41%64%64%20%43%6f%6d%6d%65%6e%74%22%20%63%6c%61%73%73%3d%22%66%6f%72%6d%62%75%74%74%6f%6e%22%20%2f%3e %09%09%3c%62%72%20%2f%3e %3c%2f%66%6f%72%6d%3e
Home | PageTop | RSS2.0 | ATOM