Using CCK to populate possible values for an if statment in

Events happening in the community are now at Drupal community events on www.drupal.org.
sanguis's picture

I have these huge chunks of html that I need to be able to select in the node settings witch one to use (if any).
I am thinking a cck float point value, and an (if || switch) statement in the contemplate. the question is the best way to store the static html chunks. As a (block || include file || some other way)

any ideas?

Comments

Write a module! :)

StephenGWills's picture

Why not write a little module called "gimme_a_chunk" that contains a hook_node. When a node is loaded, gimme_a_chunk_node() would fire off and check your cck value to see what, if any, special html chunk, this specific node needs to load and hands it back to your template as a node->special_chuck. You could even theme it and have an admin section to define and populate your chunks. Your .install file would describe the table with nid, chunk_name, actual_chunk and weight.

I realize this post is sort of like telling you that to play a flute you blow in one end and run your fingers over the holes, but you get the idea. I really think hook_node is the way to go.

Steve

good idea

sanguis's picture

but at this point I just need to bloody figure out how to preprocess a .tlp.php file as a node var.

Without more specifics I am

StephenGWills's picture

Without more specifics I am not really sure I understand what you want, but it did lead me to the idea/question: Why couldn't the function "gimme_a_chunk_node", knowing the node->nid, create or modify a page-{node->nid}.tpl.php file?

I am sure there are better ways of having your template interact with your node object than to do what I suggested but the hook_node will totally preprocess a page-node.tpl.php file if that is what you really want to do.

Western Massachusetts

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: