1
votes

I have to write a node module but have no idea how to start with. The structure look like this:

Content Type => Food {tite, description, food type} Content Type => Meal {title, description, detail( food title, sequence) }

The design view for Meal look like this: https://picasaweb.google.com/lh/photo/PanW269fpn_2dRyKkhsmTtMTjNZETYmyPJy0liipFm0?full-exif=true

On the right hand size, allow user to search the food and then drag into the left hand size (detail( food title, sequence)).

However, I had created the Meal by simply create a page heavily use of jquery (client side program). However, I don't know how to integrate this to a content type.

How to: 1. When i click new Meal, this can refer to the page i created. 2. When i click edit meal, another page is being load. 3. When I click to view the deal, a page without edit function is loaded. 4. How can this easily implement another module, e.g. flag, comment, e.g. into this content type.

May be the summary is that how can i write a node content type programmatically and which callback I should use.

Thank.

1

1 Answers

0
votes

To include a javascript file, use <?php drupal_add_js(); ?>.

If you only need to include the file on that one node, you can enable the php content filter module (which is now a part of core), and just have the above code (pointing to your custom js file for displaying the page content) inside of a block with php selected as the content filter.

This would prevent the need for your js code to be downloaded on pages other than the one(s) where you need to display this custom layout.