A very good way is that followed by the views_gallery module in its install script, where it creates the gallery and image content types, including imagefield, etc.<div><br></div><div>See <meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://drupal.org/project/views_gallery">http://drupal.org/project/views_gallery</a></div>
<div><br></div><div><a href="http://drupal.org/project/views_gallery"></a>I feel I have improved upon that in my (work in progress) Project Flow & Tracker installation profile, where I use a function from the installation profile API to create a content type and its fields from a file (holding what is exported via content copy).</div>
<div><br></div><div>You can download that here (branch <meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="color: rgb(102, 102, 102); font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 11px; line-height: 15px; ">6.x-1.0-alpha1):</span><br>
<br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="https://github.com/victorkane/ProjectFlowAndTracker/tree/6.x-1.0-alpha1">https://github.com/victorkane/ProjectFlowAndTracker/tree/6.x-1.0-alpha1</a></div>
<div><br></div><div>Victor Kane</div><div><a href="http://awebfactory.com.ar">http://awebfactory.com.ar</a></div><div><a href="http://projectflowandtracker.com">http://projectflowandtracker.com</a></div><div><br><div class="gmail_quote">
On Mon, Jan 17, 2011 at 10:37 AM, Randy Fay <span dir="ltr"><<a href="mailto:randy@randyfay.com">randy@randyfay.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
IMO, wherever possible, it's best to let CCK manage additional data on a node. And if a custom data type is to be presented, wherever possible, use features to manage it.<br><font color="#888888"><br>-Randy</font><div>
<div></div><div class="h5"><br><br><div class="gmail_quote">On Mon, Jan 17, 2011 at 2:30 PM, <span dir="ltr"><<a href="mailto:jeff@ayendesigns.com" target="_blank">jeff@ayendesigns.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div text="#000000" bgcolor="#ffffff">
Ah, makes sense. Ok, so that leaves me with one higher-level
question. Is there a question I should be asking myself to decide
whether to have cck manage the content type, its field and the
processing of both or to do it separately, other than which is
easier?<div><div></div><div><br>
<br>
On 01/17/2011 04:36 AM, Randy Fay wrote:
<blockquote type="cite">The D6 node_example in Examples is the non-CCK
technique, and it adds *data* but not fields, to a node.
Presentation and data management are done in custom code.<br>
<br>
If you just need something that CCK can do, use features and CCK
(which is essentially the easier way to do #1). <br>
<br>
Both ways work, but if you *can* do it with CCK + features I would
think that would be the best technique.<br>
<br>
-Randy<br>
<br>
<div class="gmail_quote">On Mon, Jan 17, 2011 at 4:49 AM, <span dir="ltr"><<a href="mailto:jeff@ayendesigns.com" target="_blank">jeff@ayendesigns.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">
<div style="direction:ltr" text="#000000" bgcolor="#ffffff">
I find what seems to be two different approaches for
creating fields for a custom content type via a module. One
is from drewish, where the field is first added via cck
manually, then dumped with var_export(content_fields()) and
then added to the content type in the install via
content_field_instance_create(). The other is in rfay's
Example module, where Randy creates a table for the module
in the install and inserts fields into it that are what cck
would insert.<br>
<br>
I'm wondering if the latter removes the need for me to do
all the node processing from my module. Also, my content
type has one field (other than title and body) which is an
image filefield with unlimited instances, and I'm thinking
that that same method would have the field being handled by
filefield and that the method in Example would require that
I manage the _fid, _list and _data db content, etc., so if
there's a reason why this would be a better way to do it, or
why the first method wouldn't be, I'm missing it.<br>
<br>
Jeff<br>
<div>-- <br>
<p style="margin-bottom:0in"><img src="cid:part1.01080803.00060706@ayendesigns.com" name="ayenlogo" valign="top" align="LEFT" border="0" vspace="30"> <font style="font-size:8pt" size="1">Ayen
Designs </font><font face="Times New Roman, serif"><font style="font-size:8pt" size="1"> <br>
388 Bullsboro Drive #105 · Newnan, Georgia 30263</font></font>
<br>
<font face="Times New Roman, serif"><font style="font-size:8pt" size="1"> 404-271-9734<br>
Web:<a href="http://ayendesigns.com" target="_blank">ayendesigns.com</a><br>
Blog: <a href="http://theaccidentalcoder.com" target="_blank">theAccidentalCoder.com</a><br>
Drupal: <a href="http://drupal.org/user/367108" target="_blank">j. ayen green</a><br>
IRQ: j_ayen_green<br>
IM (Yahoo) baalwww (MSN) <a href="mailto:baalwww@yahoo.com" target="_blank">baalwww@yahoo.com</a><br>
Skype: ayendesigns <br>
<br>
Ayen Designs is a tradename of the computer services
division of <img src="cid:part2.08060201.01040307@ayendesigns.com" name="acmelogo" align="absmiddle"></font></font></p>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Randy Fay<br>
Drupal Module and Site Development<br>
<a href="mailto:randy@randyfay.com" target="_blank">randy@randyfay.com</a><br>
+1 970.462.7450<br>
<br>
</blockquote>
</div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Randy Fay<br>Drupal Module and Site Development<br><a href="mailto:randy@randyfay.com" target="_blank">randy@randyfay.com</a><br>+1 970.462.7450<br><br>
</div></div></blockquote></div><br></div>