idでクラスやリンク先を変えてます。
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$press_id = 137;
$event_id = 141;
$ir_id = 134;
$isFirst = true; //So first item in list can have a different css class (e.g. no top border)
$excerptBlocks = ($controller->truncateSummaries ? 1 : null); //1 is the number of blocks to include in the excerpt
$truncateChars = ($controller->truncateSummaries ? $controller->truncateChars : 0);
$i = 0;
foreach ($cArray as $cobj) {
$title = $cobj->getCollectionName();
$date = $cobj->getCollectionDatePublic('Y.m.d');
$link = $nh->getLinkToCollection($cobj);
$parent = $cobj->getCollectionParentID();
$firstClass = $isFirst ? 'first-entry' : '';
if ($i%2 == 0) {
echo '<div class="lateone">';
} else {
echo '<div class="lighten_bd"><div class="lighten">';
}
echo '<div class="date">' . $date . '</div>';
switch ($parent) {
case $press_id :
$class = 'add_press';
break;
case $event_id :
$class = 'add_exh';
break;
case $ir_id :
$class = 'add_ir';
break;
default :
$class = 'add_press';
break;
}
echo '<div class="' . $class . '">';
echo '<a href="/index.php/news">' . $title . '</a>';
echo '</div>';
echo '<div style="clear:both;"></div>';
if ($i%2 == 0) {
echo '</div>';
} else {
echo '</div></div>';
}
$isFirst = false;
$i++;
}
Re:Re:Re:ページリストの絞り込み
2012年6月28日 at 1:40
view.phpを利用するとうまくいくのですが、元々使用していたカスタムテンプレートだとなぜかうまくいかないです;
出力するページリストをif文で条件分岐させているからだと思うのですが…。
タグ:
Re: ページリスト絞り込み
2012年6月29日 at 7:38
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$press_id = 137;
$event_id = 141;
$ir_id = 134;
$isFirst = true; //So first item in list can have a different css class (e.g. no top border)
$excerptBlocks = ($controller->truncateSummaries ? 1 : null); //1 is the number of blocks to include in the excerpt
$truncateChars = ($controller->truncateSummaries ? $controller->truncateChars : 0);
$i = 0;
foreach ($cArray as $cobj) {
if(!$cobj->getAttribute('page_list_disable')) {
$title = $cobj->getCollectionName();
$date = $cobj->getCollectionDatePublic('Y.m.d');
$link = $nh->getLinkToCollection($cobj);
$parent = $cobj->getCollectionParentID();
$firstClass = $isFirst ? 'first-entry' : '';
if ($i%2 == 0) {
echo '<div class="lateone">';
} else {
echo '<div class="lighten_bd"><div class="lighten">';
}
echo '<div class="date">' . $date . '</div>';
switch ($parent) {
case $press_id :
$class = 'add_press';
break;
case $event_id :
$class = 'add_exh';
break;
case $ir_id :
$class = 'add_ir';
break;
default :
$class = 'add_press';
break;
}
echo '<div class="' . $class . '">';
echo '<a href="/index.php/news">' . $title . '</a>';
echo '</div>';
echo '<div style="clear:both;"></div>';
if ($i%2 == 0) {
echo '</div>';
} else {
echo '</div></div>';
}
$isFirst = false;
$i++;
}
}
太字の部分が追加したものです。
defined('C5_EXECUTE') or die("Access Denied.");
$press_id = 137;
$event_id = 141;
$ir_id = 134;
$isFirst = true; //So first item in list can have a different css class (e.g. no top border)
$excerptBlocks = ($controller->truncateSummaries ? 1 : null); //1 is the number of blocks to include in the excerpt
$truncateChars = ($controller->truncateSummaries ? $controller->truncateChars : 0);
$i = 0;
foreach ($cArray as $cobj) {
if(!$cobj->getAttribute('page_list_disable')) {
$title = $cobj->getCollectionName();
$date = $cobj->getCollectionDatePublic('Y.m.d');
$link = $nh->getLinkToCollection($cobj);
$parent = $cobj->getCollectionParentID();
$firstClass = $isFirst ? 'first-entry' : '';
if ($i%2 == 0) {
echo '<div class="lateone">';
} else {
echo '<div class="lighten_bd"><div class="lighten">';
}
echo '<div class="date">' . $date . '</div>';
switch ($parent) {
case $press_id :
$class = 'add_press';
break;
case $event_id :
$class = 'add_exh';
break;
case $ir_id :
$class = 'add_ir';
break;
default :
$class = 'add_press';
break;
}
echo '<div class="' . $class . '">';
echo '<a href="/index.php/news">' . $title . '</a>';
echo '</div>';
echo '<div style="clear:both;"></div>';
if ($i%2 == 0) {
echo '</div>';
} else {
echo '</div></div>';
}
$isFirst = false;
$i++;
}
}
太字の部分が追加したものです。
Your post has been saved and will be published after approval by the forum moderator.
acliss
Re: Re:Re:Re:ページリストの絞り込み
そのカスタムテンプレート見せていただけるなら確認してみますが、どうでしょうか?