1 cindyrae Feb 29, 2008 23:15
3 cindyrae Mar 04, 2008 16:54
I see what you're getting at, now -- you're talking about option #2, below.
Since no built-in way seems to exist for option #1, I can certainly do option #2 (I already am, in a way, to present the category list under the post title). In fact, I'll probably start working that up this week.
However, #2 is not ideal.
We're still talking about losing the context from the multi-page. Or, rather, changing the context once the user hits the single page then tries to go to another internal link. If I had only one-level categories, it wouldn't matter, but I have nested categories.
Details below, if you're interested in digging further.
===========================
Given the categories, "Wild Birds" --> "Attracting Wild Birds" --> "Feeding Wild Birds", and a link entry under "Feeding Wild Birds" called "A Link to Birdseed" ---
assume the user is sitting on a multiple-post page with the intermediate category, "Attracting Wild Birds", and no entry/post type selected (still "All") and clicks the permalink for the link entry.
I can go one of two directions:
-------- 1) Context from multi-post page.
The code knows what specific category ("Attracting Wild Birds") and type ("All") were selected that got us to the permalink.
Selected root category and selected type are based on the previous context. Links from the permalink page to other internal destinations preserve the context from the multi-post page (if you click on a category link in the post, it stays with the current entry/post type).
So, the "Wild Birds" and "All" tabs are selected, and internal links on the single-post page will display multiple posts the category set to "Attracting Wild Birds".
------- 2) Context from the single permalink page
The code determines the root category ("Wild Birds"), current category ("Feeding Wild Birds"), and post/entry type ("Link") from the one post being displayed. The code does not (cannot?) determine the intermediate category ("Attracting Wild Birds") that got the user here.
Selected root category and selected type tabs are based on the current context of the page.
...and either
(a) internal links on the single page preserve the type of entry and current category of the the single post
(b) internal links on the single page preserve the type of entry and root category of the the single post
(and other options I'll skip for brevity, since they don't make as much sense)
So, the "Wild Birds" and "Link" tabs are selected, and departing links have the category set to "Feeding Wild Birds".
Wondering why I had to come up with such an "interesting" skin, anyways,
- Cindy Rae
The POST - not the URL - is in a category that got it to be part of a multi-post page, and each post knows it's own categories. I don't have files open right now so I'm winging this a bit, but I have this feeling it'll jog you in the right direction.
Basically when the page is actually creating the post it is quite capable of echoing it's categories. Using the categories() function you can tell it to only list the main cat, or only the sub-cats, or the other form of cats (which I never did understand what that means), or any combination of them. So I'll guess something like $Item->get(categories) will return an array of the categories. Or you might have to work at extracting main_cat_ID if all you want is that level of detail.
But work at it from inside the post instead of by decoding the URL because yeah the URL for a permalink page embeds the information needed to make that post display, which is obviously not always the same as the information that caused that post to be part of a multi-post page.
One trick I used to do all the time is to print_r stuff to myself.
There have been times when I'd print_r so much different stuff just hunting around randomly that the page got to be like a million miles long, but sooner or later I'd find what I was after and tighten up whatever it was I was doing.
Anyway I probably said enough when I said "use the post instead of the URL" but I love to hear myself type :D
OT: Oh and hey adding a bit on the site showcase thread saying "go look at a different thread" doesn't really add value. Those of us who look anywhere tend to look everywhere in a language we can read yah?