Creating pages based on content tags

Permalink 1 user found helpful
Hello

I am looking for a way to create tiered pages. I want to have a link for "News" at the top of the page and sequential pages say Local, National, Tech, and Business pages. On the main news page i want to have news from all 4 categories. I also want a sub page from news say tech to have all articles with the tech tag, all articles on business page to be tagged business. I am also hoping the sub pages would show in the side navigation and not another tab in the main top navigation to reduce clutter (unless it is a drop down). i know how to do this partially in joomla and drupal but i am new to concrete5 and have not figured it out yet. any help would be much appreciated and if you have any clarifying questions feel free to let me know. thank you

 
SkyBlueSofa replied on at Permalink Best Answer Reply
SkyBlueSofa
There is an add on that may be just what you are looking for: Page List plus. It lets you create page lists based on tags and many more page attributes.

I use it almost exclusively anymore when creating page lists.
mkly replied on at Permalink Reply
mkly
I'm assuming you are talking about the "Tags" attribute with the handle "tags". There is a class called PageList that you can use for that.
// in controller.php of your block
public function view() {
  // This is basically a require_once
  // for the file with the class
  Loader::model('page_list');
  // Create a new page list
  $pl = new PageList();
  // filter by the tags attribute
  // You have to do the odd \n thing
  // because of how concrete5 stores
  // multi-select attributes
  $pl->filterByAttribute('tags', '%\nNews\n%', 'LIKE');
  // order by newest
  $pl->sortByPublicDate();
  // get the first 5 (offset, limit)

Then in your view.php of the block
<!--
     $pages is what we set in the controller
-->
<?php foreach($pages as $page): ?>
  <div class="page-summary">
    <h3>
      <a href="<?php echo $nh->getLinkToCollection($page) ?>">
        <?php echo $page->getCollectionName() ?>
      </a>
    </h3>
    <!-- 
         The shortenTextWord is just to limit the text to 240
         characters cut at the word boundry
      -->
    <p>

Page lists are pretty simple. If you have basic php knowledge you can typically just write them yourself.

EDITs: lots of typos
jgkolt replied on at Permalink Reply
Thank you for your posts, i appreciate it.