I am just starting with CATS module and after classifying all my pages I am a little lost as to how I can now use all this wonderful hierarchical categorization.

So, first my example site:

CONTAINERS:
- Portfolio
- Services
- Company Info

under Portfolio I have CATEGORIES:
- Web
- Db
- Office
- Gov

and under that I have PAGES; which I classify under one (or more) CATEGORIES
- Site1 - under Web,Gov
- Site2 - under Web
- Site3 - under Web,Db

MENUS:
========
The first thought was I should be able to (and figured automatically?) get some menus:

- should I not, now, be able to (automatically) get the following menus:
Portfolio
- Web
--- Site1
--- Site2
--- Site3
- Db
--- Site3
- Office
- Gov
--- Site1

AND, if I like, just a Web menu:
Web
- Site1
- Site2
- Site3

I see there is a cats_menu module but all I have been able to do was get Portfolio listed in menu. And now I can't even get that back (following DOC on Jeremy's site) - all I get are sql "duplicate entry" error messages (perhaps a bug in cat_menu module??).

Then I found this snippet http://drupal.org/node/21390 which gave a list of all categories (but regardless of containers):

so I guess block snippet approach is cool - but can someone suggest SQL for pulling out menu items for a specific Container or Category (I think the snippet here pulls out entire site.

DYNAMIC CODE based on CON/CAT
============================
I would also now like to add some dynamic content to (for example) my header (php template) that would be something like:

if (I am on a page in Web category) then display this.jpg

CAT based node templates
=========================
Next, can I now display the "Web" category and have it use a template specific to Portfolio container?

example: would be nice to show Portfolio->Web node with 2 or 3 columns of teasers for each of Site1, Site2 and Site3

and then the same container based) node template for Db, Gov, etc. for when I display those category top pages

but this would be different than if I display something which falls under the Service container (which will have its own template).

and now.. to be REALLY COOL
===========================
lets say I have (con) Services and under that I have (cat) Web Design.

Now under Web Design I have pages (CMS, Custom and Templated).

On the CMS page I have CMS, Web Design, Service description but at the bottom of the page I have links to Portfolio pages - cuz I think when I created CMS page I added to Portfolio->Web category (as well as Services->WebDesign cat).

And of course, I guess that specific "layout" would be a template for all Services pages.

THE QUESTIONS
=============
- am I on the right track here as far as using category module to do these things?

- are there any references to the SQL or defined variables that I can use to build any of this?
- there currently is $current_node defined by CORE; is there anything like a predefined array of categories, containers that current_node exists in?
- I have used a block snippet to show block only if current_node belongs to a vocab (by pulling out array of nodes in vocab and looping to see if current is in there) - hopefully there is something easier than this - BUT is there EVEN this capability.

- am I right in thinking that everything I want to do here needs to be customized, i.e.:
- well I know there is a menu block; but it doesn't seem to work ???
- does views.module do some of this?
- is there any sort of templating thing that can be used here?

I am still pretty new to this so maybe I missed the big Categories Handbook which mentions all the cool things someone can do once they have "categorized" their site - or maybe this will be the start of it???

peter....

Comments

scrypter’s picture

I think this post highlights an issue with Jeremy's naming of his container/category module. If you install this module you get two admin menu items called "categories", one links to Jeremy's new module and one links to the taxonomy module. The snippet you refer to deals with taxonomy, Jeremy's module (as I understand it) has all categories and containers stored as nodes. I haven't checked it for a few weeks but I got the impression it was very much "work in progress". I think it is a *great* module, just wish it had a different name! Guess Jeremy is the best person to comment on your gritty questions.

www.scryptik.com - Javascript editor with syntax error checking

www.purpleoar.co.nz/scryptik - Javascript editor with syntax error checking
www.purpleoar.co.nz - Web development, Drupal consultancy

Jaza’s picture

The issue of two admin menu items called 'categories' can be fixed, by installing the taxonomy wrapper (included with category).

Yes, category is still a work in progress, but it's already stable enough that it's being successfully used on a live site (the category module site), and is getting more stable all the time.

Jeremy Epstein - GreenAsh

Jaza’s picture

OK, well the good news is, you have complex needs, and category is (if used properly) able to satisfy most of them.

To answer your questions:

am I on the right track here as far as using category module to do these things?

Not exactly. As far as menu items and navigation go, category is designed to do all this automatically (with category_menu). There's no need to use things like custom block snippets or user-defined SQL queries. I think that answers most of your other questions...

well I know there is a menu block; but it doesn't seem to work ???

If you install category_menu, and if you tick the 'menu items within this container' and 'menu items for assigned nodes' check boxes on the add/edit container form, menu blocks should be working for you. Also, check what menu is being used by category_menu in 'admininster -> settings -> category'.

I see no reason why category_menu should give you any problems. It will automatically generate the menu structure that you've described as your preferred one. The only thing it won't do is create multiple menu items for nodes that are tagged under multiple categories: it will only create a menu item under the category with the lightest weight.

Category_menu is not perfect or bug-free, but since it was released (over 2 months ago), it has been extensively tested, and a huge number of its bugs have been fixed. You shouldn't be getting any SQL errors when you use it: if you do, please submit your problems as bug reports.

does views.module do some of this?

No: the views module is a custom query builder and node-listing customizer. It has nothing to do with categorizing content, structuring your site, or creating navigation elements such as menu items. Views is a cool module, but it doesn't (quite) do everything. ;-)

is there any sort of templating thing that can be used here?

If you're referring to the kind of functionality that taxonomy theme offers, then no, this is not currently available for category. But it would be nice if it had it: feel free to work on it! Any volunteers?

I am still pretty new to this so maybe I missed the big Categories Handbook which mentions all the cool things someone can do once they have "categorized" their site - or maybe this will be the start of it???

The category documentation does not yet have this stuff covered, but it will soon. In the meantime, the PDF documents included with the category module may give you some help.

Hope that helps you - good luck!

Jeremy Epstein - GreenAsh

Jeremy Epstein - GreenAsh

liquidcms’s picture

Thanks a ton Jeremy for the response.. and now... just a few comments/clarification on your suggestions:

Not exactly. As far as menu items and navigation go, category is designed to do all this automatically (with category_menu). There's no need to use things like custom block snippets or user-defined SQL queries. I think that answers most of your other questions...

- well I will play a bit more with cat_menu and I have some of the in page navigational stuff working now (as built in to cat_display); but I think there will always be need for the snippets I am looking for - which I think may have been my main question here:

- even as you state, cat_menu can't give me pages in both Categories menus; which really shouldn't be that big a deal to code with a custom snippet block
- I will still need "snippet" like code for things like my dynamic header: "if (node in catX) then do this"

re: cats_menu stuff

- still pretty sure there are bugs here; or the method to make this work is too complex that I just haven't stumbled upon it yet.
- perhaps if you could give me an example of what to expect (maybe even using my example) it would help
- like I said I get my containers listed - just nothing under them

- and to clarify (and I think you have suggested I can't really get this???) what I would really require is a menu (block) per category
- and then actually what I likely would do would use the conditional block function to only have the block for a cat ON when I am at a node that exists in that cat... again... snippets.. I think

BUT.. what should I get???? perhaps:

Container1
  - Cat1
      - page1
      - page2
  - Cat2
      - page3
      - page4
  - Cat3
      - page1   (think you said I can't get this??)
      - page5
Container2
  - Cat1         (can't get this one either????)
      - page1
      - page2
  - Cat4
      - page7
      - page8

is this what I should be looking for?.. if it is.. I will start raising some bug reports.

No: the views module is a custom query builder and node-listing customizer. It has nothing to do with categorizing content

I realize that views has nothing to do with categorization of content - what I was referring to was could it be of use to give me custom node views based on container or category?

is there any sort of templating thing that can be used here?

If you're referring to the kind of functionality that taxonomy theme offers, then no, this is not currently available for category. But it would be nice if it had it: feel free to work on it! Any volunteers?

I do know about tox themes, which I guess is close - all I really was looking for though was ability to "theme" a node based on cat/con. Which I guess is sort of like tox theme except that it does whole site.

Again, since I am new to cats I am not completely sure I quite get all of this - but the idea of cat_node_theme seems like it would be pretty slick. If I get some of the other things figured out here - maybe I will look into it. Doesn't seem like it would be too difficult. I think phptemplate engine has a node_template - so I guess could simply tie into using that - but again.. I'll need my little snippet to set variable so that my theme knows what cats/cons my current_page belongs to.

The category documentation does not yet have this stuff covered, but it will soon. In the meantime, the PDF documents included with the category module may give you some help.

I have read it all.. lol... thanks.

I guess I will try a couple more attempts at menus.. but I suspect my database has been corrupted now (by cat_mod).

Also, this one has really been messing with me.. .but (I think) cat_mod severly messes up my custom php theme.. not quite sure yet... but I was working on theme for quite some time.. added cat_mod.. and theme went haywire... removed cat_mod and theme still busted... replaced with DB prior to cat.mysql.. and it was ok again... then left theme.. went back to a standard them for a while; to sort out cat mod stuff.. flipped back just now to my custom theme again.. and it is corrupted again... very odd the way it is mess up as well... need to do some more tests to find out correlation between my theme and cats (hard to believe there is one???)

thanks, and i'll keep pluging away
peter....

mcreature’s picture

The “Taxonomy context module” can do some of this block display stuff you want, but does not work with the Category module as far as I know; haven’t tested it in a few weeks.
It sure would be cool to have a Taxonomy Context type module that could co-exist or even offset the Category module, than we could also display a hidden description text, like the Civicspace theme does, as help” along with the main content, just a thought.

merlinofchaos’s picture

No: the views module is a custom query builder and node-listing customizer. It has nothing to do with categorizing content

I realize that views has nothing to do with categorization of content - what I was referring to was could it be of use to give me custom node views based on container or category?

Once Jaza gets views integration into category, I think views will do a lot of what you want with category. For now that doesn't yet exist.

-- Merlin

[Point the finger: Assign Blame!]
[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]

-- Merlin

[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]

liquidcms’s picture

i took a very quick look at views.. and i mean quick...

didn't really get it... but perhaps i will take a better look later today.

and then maybe; if it seems to do what i want... will look at cats integration myself.

thanks for the tip,
peter...

merlinofchaos’s picture

I'll warn you in advance that it's going to be one of the harder integrations of all the modules. Anything that deals with hierarchies is kind of rough.

-- Merlin

[Point the finger: Assign Blame!]
[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]

-- Merlin

[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]

kae’s picture

Merlinofchaos,
you are a great person to answer this question. I've been wondering why hierarchies are such a big problem in Drupal (and less so, it seems, say in Typo3). What is it about the architecture of Drupal that makes things related to hierarchies so hard to do as you say?
thank you,
ae

merlinofchaos’s picture

It's not a problem in Drupal in particular, it's a problem with SQL and relational databases, really. In general, the difficulty with hierarchies is that loading a hierarchy tree takes one query for branch leaf of the tree, rather than just one query that can get the whole thing. So the more complex your hierarchy, the more queries are required.

Now, there are tricks that can be done to get around it (the taxonomy lineage module does one such trick; and comment module does a similar trick) but they come with their own limitations and aren't always suitable.

-- Merlin

[Point the finger: Assign Blame!]
[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]

-- Merlin

[Read my writing: ehalseymiles.com]
[Read my Coding blog: Angry Donuts]

kae’s picture

merlinofchaos, thanks for explaining this. that's helpful. I interpret this to mean "it's possible, it would just take too long to be feasible with complex hierarchies" and that other programs (perhaps typo3) can do it because they are written more efficiently (at the cost of flexibility and ease of use for non-programmers.) it may also be that typo3 has a relatively rigid hierarchical structure that does not allow multiple/complex parent-child relationships.

kae’s picture

upon further reflection, I wonder how does craiglist and yahoogroups do it? I guess they have a simple drilldown procedure where one post can only have one parent. But if that is the case, my beef with Drupal is why does it have the ridiculously long pull-down boxes where every page of a book shows up? I posted about this problem at
http://drupal.org/node/54017

Drupal cannot do something like craiglist or yahoogroups as far as I know. (I guess some of the newer AJAX functionality is aiming at this). If Drupal can do something just like craiglist or yahoogroups, please (ideally point me to a sample site) and let me know which modules I should use! thank you.

upon further investigation, it is possible that Drupal can do a craiglist with book.module and merlin's dashboard. problem is book.mod only has 2 fields. also, the interface is a problem when the lists are too long.

jeff's lullabot site talks about some promising AJAX searching being developed that could do this in the future I think. next week if i have time i'll post that url here.