Domanda

Is there a way to get a field's teaser value with php? I can get the fields value with some php like this..

<?php print $node->field_country[0]['value'] ?>

I tried this..

<?php print $node->field_country[0]['teaser'] ?>

But that does not work. :(

È stato utile?

Soluzione

Have you tried

<?php print $node->field_country['und'][0]['value'] ?>

This could work.

If it didn't, use

<?php print_r($node->field_country); ?>

to go through the properties of the field.

Altri suggerimenti

Fields don't have "teaser" and "full" values. Only nodes have teser and full views.

To see the full contents of a field array in Drupal 6, install the Devel module and use:

<?php dpm($node->field_country); ?>

Note that the previous suggestions:

<?php print $node->field_country['und'][0]['value'] ?>

relates to the structure of fields in Drupal 7.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top