I created a content type with cck and added a subform to that element. I tried to do a custom template, and the subform elements stop showing up. All the non-subform elements can be reached at 'field_fieldname' but I can't seem to figure out how to printout the subform elements. I really need to create a custom template for my content type, but the array of subform elements doesn't seem to be passed to the template.

I have a little bit of experience with drupal, so maybe I'm just not doing it correctly. Thank you ahead of time for the help.

Comments

MrTaco’s picture

can you give me a link to your website? and possibly a user account there, and i'll take a look

lunas’s picture

Did you ever figure out how to do this? I'm trying to do the same thing, so far with no success. Thanks.

ssherriff’s picture

Sorry, I was away for the holidays.

Here is a link to the site: Website

I'm not sure how that will help though. It may be a bit slow as well as it is on my home server. The code I have in my tpl file is as follows:

<div id="node-content-album">
	<div class="field-field-album-cover">
	  	<?php foreach ((array)$field_album_cover as $item) { ?>
		<?php print $item['view'] ?>
		<?php } ?>
	</div>
	<!--div class="field field-type-number-integer field-field-release-year">
	  <h3 class="field-label">Release Year</h3>
	  <div class="field-items">
		<?php foreach ((array)$field_release_year as $item) { ?>
		  <div class="field-item"><?php print $item['view'] ?></div>
		<?php } ?>
	  </div>
	</div-->
<div class="field-field-songs">
  <h3 class="field-label"><?php print $title?></h3>
  <div class="field-items">
	<?php print $node->field_songs[0] ?>
    <?php foreach ((array)$field_songs as $item) { ?>
      <div class="field-item"><?php print $item['view'] ?></div>
    <?php } ?>
  </div>
</div>
</div>

The songs are the subform item.

Do I maybe have to template a view instead? I guess I'm just not 100% how subform works, so its hard to figure out how to alter it/template it.

Thanks,
Steph

rfcm’s picture

Are there are any updates to this issue? I am experiencing the same behavior. I would like to use templating to define the layout.

As a side note, I see a HUGE value with this module and I can foresee others using this extensively.

casey’s picture

Status: Active » Closed (fixed)