Display pages by category/attribute?
Permalinknav item another nav item third nav item sub category 1 sub category 2 sub category 3 … another nav item
When the visitor clicks on one of these category links only the people that belong to this category should be displayed in the main section. What’s the best approach to go about this?
The way I’m thinking it now is that I have a separate page for each person which could get one or more text attributes containing the category they belong to, and then use the page list block to list them. But how am I going to filter that by category/attribute and how am I going to display these categories in the navigation?
http://www.concrete5.org/community/forums/block_requests/content-re...
...or if you don't want to touch code at all there's also a paid marketplace addon that does a similar thing (and is probably a bit more polished than the free one linked to above):
http://www.concrete5.org/marketplace/addons/related-pages/...
http://www.concrete5.org/community/forums/customizing_c5/get-page-t...
http://www.concrete5.org/community/forums/customizing_c5/how-to-wan...
So, I have tried the related content block jordan proposed but it’s only allowing to choose one category to display the content from. What I need is a list of attribute values on the front end where I can click on one of these links and it shows me the pages that belong to that category. And I actually kind of found that with the tag cloud that comes preinstalled, which is the search block with a custom template, using the also preinstalled tag attribute.
This is almost exactly what I need except I need it within my autonav as submenu of the current page. I have to split right now and I’m gonna try to implement the code from the custom search template into my custom autonav template when I’m back. I’d still be happy about any idea or guidance that could be useful for this matter – especially how I would highlight the currently selected attribute/category once it shows the results (like adding a “current” class to the currently selected tag/category).
Thanks!
<?php defined('C5_EXECUTE') or die("Access Denied."); $aBlocks = $controller->generateNav(); $c = Page::getCurrentPage(); $containsPages = false; $nh = Loader::helper('navigation'); //this will create an array of parent cIDs $inspectC=$c; $selectedPathCIDs=array( $inspectC->getCollectionID() ); $parentCIDnotZero=true; while($parentCIDnotZero){ $cParentID=$inspectC->cParentID; if(!intval($cParentID)){ $parentCIDnotZero=false; }else{
Now, this is putting the list of tags I have in a sub list. However, the search block allowed to select tags of pages from a certain sub page and to post the results to a certain page, too. Since I’ve hard coded this into the template as you can see here (have a page called “results” and had to remove the “$resultTargetURL” stuff):
<li><a href="<?php /*echo $this->url($resultTargetURL)*/?>results?<?php echo $qs?>">
… this is no longer working. I think it’s not too much of an issue to hard code the results page name into the template but how can I retreive only those tags from the sub pages of the current page?
And how would I make it that a specific “current” class is assigned to the list item that’s currently selected? The results page doesn’t know which tag link has been clicked – hm, but somehow the results page does know which results to display so there must be a way to tell the tag list, too? I’m grateful for any enlightenment. Please.
//before the loop
$selQs = $_GET['filter'];
if($selQs == $qs)$selClass = " class='selected'";
else $selClass = "";
//within your tal li loop
<li<?php echo $selClass?>><a href="goingSomewhere?">
I have no idea if this is the best way to do it but it can be done within the view to prevent any editing of the controller. Maybe someone else can point a tidier way to do this?
Then in your member list add either a filter from a $_GET to filter by category, or create a page for each category with the member list on each pre-filtered by that attribute.
You can get a list of the attributes, from the table or as a quick fix hardcode them in.