Thanks Leon, I’ll come back to this tomorrow and try it again.
I can provide you before/after samples of my code and go through what does and doesn’t work + the urls I’m using like you mentioned.
-Jeff
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
May 25, 2011 11:21pm
Subscribe [2]#16 / Jul 20, 2011 4:57pm
Thanks Leon, I’ll come back to this tomorrow and try it again.
I can provide you before/after samples of my code and go through what does and doesn’t work + the urls I’m using like you mentioned.
-Jeff
#17 / Jul 21, 2011 9:59pm
Hi Leon,
So I gave this another try today and still didn’t have much luck.
What I did was duplicate my current video template group and called it video_2 so I can use that as my sandbox until this is working right.
Let me first lay out what I have in the this template group:
index (this is where the user first ends up when they click “video” from the site main nav, it displays the 10 most recent entries from all of the categories)
page (this displays entries from whatever category you select in the top right)
view (this displays the entry you click on along with other entries from the same category)
video_style (css for all 3 templates)
Next I’ll explain how the templates function before adding the GW catmenu. So at first the user will hit the index, here there will be 1 Featured Video on the left that will always be there. Underneath that are 8 thumbnails from the entries of all categories of the videos channel, the user can click on these and see them in the view template. In the upper right the user selects the category and will be brought to the page template. Beneath the categories the user can click on the title of the entry and see it in the view template.
So basically, I have the user start at the index then after that they are basically switching back and forth between the page and view template depending if they are clicking on a category name or an entry title / thumnail.
FYI, I’m using the Channel Videos addon from DevDemon located HERE
Ok, so now onto today when I tried to implement this again (in my video_2 template group) and the results I’m getting. Starting from the index I’m able to click on an entry and view it but I’m not seeing any active state being applied to the category it belongs to. When I click on any category from any template it won’t bring up any results and also has no active state for it.
I do think it has something to do with the urls possibly like you mentioned, or the fact that I’m using {exp:channel:entries} to display the results to the user. I’m just not sure at this point.
I’ve attached 2 .zip files, one for my code before and one for after. I figured it would be better to show them to you that way so the urls don’t get removed due to the EE Forum formatting.
Now I’ll list the lines of code to look at in my files so you won’t have to dig through them.
video template group (before)
index: 50-56, 59-70
page: 50-58, 61-72
view: 52-60, 63-74
video_2 template group (after)
index: 50-56, 59-70
page: 50-56, 59-70
view: 52-58, 61-72
I know its a looong post but I thought it was the only way to fully explain whats happening while also giving an idea about how it functions + include my code samples.
I have also added EE comments and extra spaces to give further clarification in my code.
If you have a chance take a look and let me know what you think.
Thanks,
-Jeff
#18 / Jul 22, 2011 1:33pm
Hi Jeff,
Thanks for the detailed post. It’s a bit much to go through all at once, so let me try to break it down by first looking at the page template.
I’m going to assume you’re going to try this out in the video_2 template group.
You’d call the template like so:
http://example.com/index.php/video_2/page/category/community
This means that in your case, the category url_title is in segment_4.
So, the code you should be using in the page template looks like page-1.pdf (see attached - the forum won’t let me post code like that).
The active class will now be added to the category that’s being called.
Notice how I’ve also changed the path to the category pages? That’s because all links to the categories went to the same page with your code.
In order for this to work, you need to make sure you’re always using URLs like this for the category pages:
http://example.com/index.php/video_2/page/category/community
For example, in your index template, in the gwcode_catmenu code, you need to fix the path to the category pages so it looks like this:
{path="video_2/page/category/{cat_url_title}"}Ok, let me know how that’s working..and if you’re able to work on the rest from here or if you need further help with the view template for example!
#19 / Jul 22, 2011 6:27pm
Alright, great news.. I finally got this working today for all 3 templates!!
I can’t say thank you enough Leon, wouldn’t have been able to get this working without your assistance. If you’re ever out in the bay area sometime let me know, I definitely owe you a few pints haha.
My clients site is scheduled to launch next month and I was worried about getting this usability feature working, feels good now that its taken care of. Next step is to implement the same type of category nav into the blog.
I’ll post back in a bit with the finished code I used along with the css.
-Jeff
EDIT: Ok finished code sample is attached, hoping this will be useful to others doing the same thing.
#20 / Jul 22, 2011 8:11pm
That’s great Jeff, congrats!
I can imagine the relief when it’s taken care of so you can take care of the rest.
The pints will be a bit of a problem as I live nowhere near the bay area (Netherlands), but hey, it’s the thought that counts.
Glad you have it working..and thanks for posting the code for others to see!
Cheers,
Leon
#21 / Oct 24, 2011 4:11pm
Hi Leon
So the site relating to this thread was finally launch last month.
Just wanted to say thanks again for your help and give you a chance to see the finished product.
Its a community-based site for disaster preparation, response and training services in the S.F. Bay Area.
I’ll post an actual announcement thread on here shortly but for now here is the urls:
And here are the 2 pages where I’m using the active state category navigation:
#22 / Oct 25, 2011 2:12pm
No problem Jeff!
It’s looking great and seems to be working perfectly, good stuff!
Thanks for taking the time to let me know 😊