Prior to rc7, a statement like

print $node->field_product_salespage[0]['view']

would print the value of a CCK field, formatted according to the settings for that field. No longer. It doesn't even appear that the ['view'] element is available. Is it now up to me to do all the formatting, or is there a hook_theme() available to help?

CommentFileSizeAuthor
#7 Picture 1.png38.87 KBjrglasgow

Comments

yched’s picture

Status: Active » Postponed (maintainer needs more info)

Not sure what's wrong with your setup, but $node->FIELD_NAME[0]['view'] is correctly populated on my test install.
Note that you can now also use $FIELD_NAME_rendered variables, that contains the fully themes field (all values, with label).

See cck/theme/README.txt fro more info.

mrtoner’s picture

Project: Content Construction Kit (CCK) » Content Templates (Contemplate)
Version: 6.x-2.0-rc7 » 6.x-0.14
Component: General » Code

Must be Contemplate, since the ['view'] element becomes available when I disable that template.

Micha1111’s picture

Project: Content Templates (Contemplate) » Content Construction Kit (CCK)
Version: 6.x-0.14 » 6.x-2.0-rc7
Component: Code » General
Category: support » bug

There is the same problem with cck-fields in contemplates since cck rc7, but I don't no, if it is a problem of this module.
$node->FIELD_NAME[0]['view'] isn't available, only $node->FIELD_NAME[0]['value']

mrtoner’s picture

Project: Content Construction Kit (CCK) » Content Templates (Contemplate)
Version: 6.x-2.0-rc7 » 6.x-0.14
Component: General » Code
Priority: Normal » Critical

Really. Here's with Affect body output enabled:

Array
(
    [0] => Array
        (
            [url] => http://example.com/product
            [title] => 
            [attributes] => Array
                (
                    [target] => _blank
                )

            [display_url] => http://example.com/product
            [html] => 1
            [display_title] => Product Name
            [label] => Sales page
        )

)

and without:

Array
(
    [0] => Array
        (
            [url] => http://example.com/product
            [title] => 
            [attributes] => Array
                (
                    [target] => _blank
                )

            [display_url] => http://example.com/product
            [html] => 1
            [display_title] => Product Name
            [label] => Sales page
            [view] => Sales page  <-- this is a formatted link
        )

)
yched’s picture

This should be kept in Contemplate queue IMO, at least until this can be pointed to a specific part of CCK.

yched’s picture

Project: Content Templates (Contemplate) » Content Construction Kit (CCK)
Version: 6.x-0.14 » 6.x-2.x-dev
Component: Code » General
Status: Postponed (maintainer needs more info) » Closed (duplicate)

OK, got it.
This is because in RC7 the ['view'] item is populated in the node template preprocessor - which contemplate obviously bypasses.
This is also causing #308778: token / contemplate broken - missing $item['view'], so marking as duplicate.

jrglasgow’s picture

StatusFileSize
new38.87 KB

When you go to edit your content type, there is a tab display fields. This allows you to specify whether your fields are viewable in your teaser or body, whether there is a label for it, etc... If the display settings for a field is set to hidden the $node->FIELD_NAME[0]['view'] will not be created, therefore this variable might exist in your list of body variables, but not exist in the list of teaser variables.

The attached image shows this page.

liquidcms’s picture

Status: Closed (duplicate) » Active

at the risk of being flamed by yched i am removing this as a duplicate.. sorry

just in the process of converting over a fairly large site (170 modules and 100k nodes) from D5 to D6 and noticing that none of the fields in the node object contain the ['view'] property.

we don't use Contemplate and display settings are set correctly.

it seems to be global across all field types as there is no 'view' set for image, text, noderef and other fields

perhaps not a CCK issue; but it isn't limited to Contemplate... maybe some other module (that used to work in D5)

liquidcms’s picture

thought maybe it was some module on our site but have looked at other D6 sites and same thing - i think ['view'] property is no longer (in D6) appended to the node object.

which means all the theming functions that we call in _nodeapi('view') will need to be recoded.. :(

was there a reason this was dropped? seems pretty useful to have the rendered field available in the node.

liquidcms’s picture

ok, got it.. as yched suggested above 'view' addition to the node object has moved (not sure when; i tried rc6 and still the same there).

in D5 it used to be available in nodeapi ($op = view) but if not added until preprocess_node this will no longer be the case.

i'm sure a good reason for this.. but sure going to be a pita..