How to get pagelist that exclude from nav?

Permalink
I try to get pagelist that exclude from nav like contact, sitemap, about, etc.
but i can get it till now, can someone help?

Loader::model('page_list');
$pl = new PageList();
$attributeKeyHandle ='exclude_nav';
$value = '0';
$comparison = '';
$pl->filterByAttribute($attributeKeyHandle, $value, $comparison);
$pages = $pl->getPage();
echo "<pre>";
print_r($pages);
echo "</pre>";


i miss something..

fastcrash
 
thephilm replied on at Permalink Reply
thephilm
I've used a custom template to achieve this using this as the code in the block override:
<ul class="news-items">
<?php 
  for ($i = 0; $i < count($cArray); $i++ ) {
    $cobj = $cArray[$i]; 
    $title = $cobj->getCollectionName(); ?>
   <li><a href="<?php echo $nh->getLinkToCollection($cobj)?>"><?php echo $title?></a> - <?php echo $cobj->getCollectionDatePublic('F j, Y') ?></li>
<?php } ?>
</ul>

Hopefully this helps out...
Note - I use this as a way to display my blog posts as an unordered list which have the "exclude from nav" flag.
- Phil
fastcrash replied on at Permalink Reply
fastcrash
thanks for the reply thephilm

i try this solution
Loader::model('page_list');
$pl = new PageList();
$pl->filterByAttribute('exclude_nav',true); //show menu that exclude from nav
$pages = $pl->getPage();
foreach($pages as $item){
   echo '<a href="'.$item->cPath.'"  >'.$item->vObj->cvName.'</a>  |  ';
}

for some reason, i add this hardcode, not from add block feature.

but now, the system page(or single page like 'confirm sign up' is shown too, i must hide this system page as well, any clue?
fastcrash replied on at Permalink Reply
fastcrash
well, i just add some condition from loop

foreach($pages as $item){
if($item->ctHandle != null) //add this
echo '<a href="'.$item->cPath.'" >'.$item->vObj->cvName.'</a> | ';
}