I try to theme content-types using phptemplate, but it don't works anymore. I used contemplate.module for this in the past, but contemplate is broken with the current 5.x-1.x-dev version. There is no longer the $item['view'] variable available in the $node object! I don't know if this is a bug or if this is wanted. If this is wanted, what's the new way of accessing the formated value of a field from within a phptemplate file?

I used to access the formated value of a field this way:

<?php foreach ((array)$field_name as $item) { ?>
  <div class="field-item"><?php print $item['view'] ?></div>
<?php } ?>

How would I do this now? Is there maybe a hook to format a field using a certain formatter now?

CommentFileSizeAuthor
#4 contemplate.module_0.patch2.75 KBkarens

Comments

yched’s picture

Status: Active » Closed (duplicate)
karens’s picture

Title: $item['view'] no longer available for theming? » Needs updating to work with new CCK method of handling teasers and views
Project: Content Construction Kit (CCK) » Content Templates (Contemplate)
Version: 5.x-1.x-dev » 5.x-1.1
Component: content.module » Code
Category: support » bug
Priority: Normal » Critical
Status: Closed (duplicate) » Active

Found at least part of the problem. Contemplate has a theme function theme_contemplate_field() that needs to be updated to incorporate the new method of handling teasers and views. It is using the old theme formatting defaults from the original CCK field template.

I'm not sure exactly what change is needed to contemplate and if this is the only place that needs to be fixed.

karens’s picture

The loss of the 'view' item in the array was a bug in CCK which is fixed in latest commit. We still need to fix the theme function here to match the recent CCK changes. I'll post a patch for that shortly.

karens’s picture

Category: bug » task
Priority: Critical » Normal
StatusFileSize
new2.75 KB

Here's a patch that alters the theme_contemplate_field() to be consistant with the current theme_field() in CCK (which may or may not be the way you want it to work.)

I'm changing the critical back because the critical problem was in CCK and was fixed, and changing it from a bug to a task because I don't know if it really qualifies as a bug.

jrglasgow’s picture

Status: Active » Postponed (maintainer needs more info)

is this still a problem that needs to be fixed?