Is it possible to have different Story Types (for taxonomy purposes)

newdru - November 27, 2006 - 06:02

I've started creating content for a site.

So far, the content all fits nicely into the story content type so i don't see a real need to create any new content types.

My requirements are that all stories must be tagged with 1 or more terms. To enforce this requirement, i put a check in the checkbox to make my vocabularies mandatory in the admin settings.

One "type" of story (lets call it A) requires the following vocabs:
- Type of Media
- Region
- Topic

The other "type" of story (lets call it B) requires a different set of vocabs:
- Service
- Industry

This creates a problem. Because BOTH A & B are defined as STORY CONTENT TYPES (the basic simple node type drupal ships with), whenever you go to add a story, you will ALWAYS SEE ALL 5 REQUIRED CATEGORY SELECT MENUS AND YOU WILL BE FORCED TO CHOOSE AT LEAST ONE FROM ALL OF THEM. This means that if you want to create a TYPE A story, you will also need to enter terms from both Service and Industry categories even though they have nothing to do with TYPE A stories. If you create a TYPE B story you will also be required to select terms from the TYPE A categories Media, Region, Topic which have nothing to do with TYPE B stories. This basically results in false classification.

NOTE: i do NOT want to fix this by turning off the "required" checkbox. That's not a solution.

Something tells me others have run into this before.

Hopefully i'm overlooking something really simple to fix this.

In sum:

1) Any idea how to solve my dilemna without having to create another node type for TYPE A and B?
2) is there a way to differentiate or create children of the story content type (maybe we can clone them into new types easily)?
3) if i have to create new node types and i want them to be exact duplicates of a story content type except a different name, how would i do that?
- clone to a CCK (is that possible)?
- or maybe even just duplicate the story.module and simple change it's name?

thanks in advance

I don't see any other way

cog.rusty - November 27, 2006 - 07:37

I don't see any other way except creating different node types if you don't want all your categories to appear. All the ways you described are possible, but the easiest is the CCK module. It will take just a few minutes. Then you can assign one of these node types to each vocabulary.

Yeah...

newdru - November 27, 2006 - 08:16

I figured this might be the only way.

I know it wouldn't take very long to create a CCK that mimics the story content type BUT:

1) i wanted to try and leverage the story type since new CCK types add more table lookups to each hit since the new fields iwind up in an extra table or 3 outside of the base node table. would you know of any good documentation on how the CCK extends the original node with new tables (just curious)?

2) is there any way to clone a story content type into a CCK type (it would just save a little bit of time)?

thanks

node_revisions and new CCK types

newdru - November 27, 2006 - 10:37

To refine my question:

the basic page and story nodes seem to store all node "content" data in the node_revisions table in the following fields:

- title
- body
- teaser

my new CCK content doesn't need anything more than a title, body and a teaser.

BUT. when you create a new CCK content type you only get access to the node_revisions title field. You lose the body, and teaser fields and in essence have to recreate those as new field types in the new CCK. that means you're hitting 3 tables instead of 2. Kind of a waste. That's why i was hoping i could create a new "simple" content type that is completely stored in the node_revisions table.

would the only way to do that be to dup the story.module or page.module as mystory.module and then hack a new name and type variable inside my new module or would it be a lot more intensive than that?
and would it even be worth it?

thanks

Well you could always create

zis - November 27, 2006 - 11:32

Well you could always create a new module to create a new content type.. It is really easy to modify the story module to define a new content type.. witht same properties as the story..

How exaclty would i do that

newdru - November 28, 2006 - 02:47

it seems pretty easy (even though i've never written a module before) because the two types would be identical.. only the name and type probably need to change and maybe that's it.

So.. would you be able to give any pointers on how to do this (what lines need changing in the duplicate of teh story module to create a new derivative type)?

thanks

"How to create your own

cog.rusty - November 28, 2006 - 03:40

"How to create your own simple node type (from story node) (Drupal 4.7)"
http://drupal.org/node/40684

More general: "Creating new node types - a tutorial"
http://drupal.org/node/71954

This is useful to know, but I wouldn't bother to do it. The upcoming Drupal 5 is already using a part of CCK for creating new simple node types easily (without additional fields) and it is possible that the standard node types (story, page, blog entry etc) will not exist in the future.

Thanks A Lot For This

newdru - November 28, 2006 - 07:25

That would be exactly what i wanted to do but for right now, i can work around it i imagine or just create a CCK type.

Could you say more about the new content types in 5 or direct me to some links if you know of any? I'm curious to where this is heading.

As i dig into the innards of drupal, i'm finding that teh relationships between the node, node_revisions, node_, node_content_types, etc tables are somewhat confusing and wonder if that structure needs changing. Something that pops out to me is the use of strings to relate some of these tables versus integers (content_types as strings versus integer ids with a label field, the duplication of titles across tables, etc). Just curious.

thanks for the post..

The story and page node

cog.rusty - December 1, 2006 - 07:07

The story and page node types are not dropped from Drupal 5, but the story and page modules are. Support for revisions is a different matter from node types and it stays. The mother of all discussions on content types is here:

http://drupal.org/node/62340

thanks for the link...

newdru - December 3, 2006 - 01:12

that's a long thread but looks like has some great information...

any idea how story and page nodes are going to be implemented?
are they going to be rolled in as a cck or back into the original node module?

because those types are so fundamental to drupal i'm also expecting that in the event of any changes, the next version would also provide a migration feature if needed - correct?

All node types will be

cog.rusty - December 3, 2006 - 03:29

All node types will be derived in a CCK way in the future. One or two, perhaps story and page or some other will be pre-made for you in this way, just for the convenience of new users (it would take a minute to create them themselves if they knew how).

About data migration, what is certain is that there will be an upgrade path for the specific form of CCK which will be implemented in core. It will probably be a somehow simplified form for now. I am not sure about node types which use very advanced CCK features. There is also the question whether CCK will be assimilated (maybe in Drupal 6) or will continue to be developed.

Sweet

newdru - December 3, 2006 - 04:01

You answered all which prevents me from having to do a lot of digging.. and also helps me chart my development future right now...

many thanks

Page content type

SimonP - November 27, 2006 - 14:26

Do you already use the 'page' content type for something else?

If not, both story and page nodes work in the same way, so a simple solution would be to assign certain categories to stories and use them for type A items and assign diffrent categories to pages and use them for type B items (or vice versa).

=============================
it's not hardware, it's not software, it's headware
=============================

Actually i do

newdru - November 28, 2006 - 07:26

But this is a simple enough and reliable suggestion. thanks.

ContentO module

wuf31 - November 28, 2006 - 03:23

I'm currently seeking this functionality myself,
and recently found the ContentO module.
I haven't tried it, but perhaps it is the answer to the question.
Let us know if it helps.

How about...

newdru - November 28, 2006 - 07:28

you check it out and let me know if it works :-)...

I've got other fish to fry right now but if i get around to it, i'll post results..

The fish is fried and i'll say it's yummy

wuf31 - December 1, 2006 - 06:09

Okay, I need one, tested it yesterday.
Well, it works, no need to write a new node type module, whatsover.
Took me less than 2 minutes to build one :D
IMO, it's one of those great modules lacking of good documentation.
Sure hope it helps. Thumbs up 4 this module!!

-=- Jhon -=-

What concerns me, looking at

cog.rusty - December 1, 2006 - 08:44

What concerns me, looking at its single release last June and the low activity in its issue queue, is that it looks a bit neglected.

This may be because its goal was very specific and limited, but I can't bring myself to put content in it which I would want to migrate later.

LOL!

newdru - December 3, 2006 - 01:07

the fish is fried and it's yummy ;-) ummm ummm finger lickin' good...

thanks for trying this and posting your results.. it sounds like a viable option

 
 

Drupal is a registered trademark of Dries Buytaert.