Page list filter with custom select attribute?
Permalink
I've gotten the page list to filter based on a custom checkbox attribute. What I'd really like to do is filter the page list based on a custom select attribute. Has anyone done this that can offer guidance?
Thanks,
-Foster
Thanks,
-Foster
Awesome! I got it to work by editing your Related Content Links block.
One question:
Is there a way to keep the current page from showing up in the list of related content links?
For further clarification - I am working on a portfolio site for a firm that is posting work for about 100 clients, each client having a separate page with different types of work. So we might show work for Client A in Disciplines T, U and V.
I edited your Related Content Links block to show:
"Client A can be seen in: Branding Packaging Logos"
but I'd like for the Branding link to not be seen on the Branding page.
I'm still learning php - so hopefully this code is somewhat efficient. Any pointers are more than welcome.
One question:
Is there a way to keep the current page from showing up in the list of related content links?
For further clarification - I am working on a portfolio site for a firm that is posting work for about 100 clients, each client having a separate page with different types of work. So we might show work for Client A in Disciplines T, U and V.
I edited your Related Content Links block to show:
"Client A can be seen in: Branding Packaging Logos"
but I'd like for the Branding link to not be seen on the Branding page.
I'm still learning php - so hopefully this code is somewhat efficient. Any pointers are more than welcome.
<?php defined('C5_EXECUTE') or die("Access Denied."); ?> <?php $title = htmlspecialchars($page->getCollectionName(), ENT_QUOTES, APP_CHARSET); ?> <div class="related_content_links"> <?php if (!empty($title)): ?> <?php endif; ?> <div class="disc_cont"> <div class="disc_heading"><?php echo $title; ?> can be seen in: </div> <div class="discipline"> <ul> <?php foreach ($pages as $page): $link = $nh->getLinkToCollection($page); $title = htmlspecialchars($page->getCollectionName(), ENT_QUOTES, APP_CHARSET); $date = empty($dateFormat) ? '' : date($dateFormat, strtotime($page->getCollectionDatePublic())); $dp = $page->getAttribute('discipline');
Viewing 15 lines of 27 lines. View entire code block.
If I'm understanding things correctly, it should be fairly easy. Try adding this new line above the existing "foreach ($pages as $page):" line:
...and then add this new line *below* the existing "foreach ($pages as $page):" line:
$currentPageCID = Page::getCurrentPage()->getCollectionID();
...and then add this new line *below* the existing "foreach ($pages as $page):" line:
if ($currentPageCID == $page->getCollectionID()) { //skip this item because it is the current page continue; }
Amazing! Totally works!!!
Thank you so much for the help on this specific question - and for the tons of other content you've posted over the years!
-Foster
Thank you so much for the help on this specific question - and for the tons of other content you've posted over the years!
-Foster
You're welcome! Glad I could be of help.
http://www.concrete5.org/community/forums/block_requests/content-re...
http://www.concrete5.org/community/forums/customizing_c5/how-to-wan...