When outputting a template for a list view (from CCK nodes) the tpl file is filled with incorrect variables like this:
print $field-release-date-value
The result is that fields aren't displayed.
By substituting hyphen with underscore, everything works:
print $field_release_date_value

Comments

Permanently Undecided’s picture

I can confirm this and also that the fix suggested works perfectly.

Anonymous’s picture

Another confirmation. It solved my problem http://drupal.org/node/105193
Thanks for the info.

dodorama’s picture

Priority: Normal » Critical

just to rise attention on this bug

Permanently Undecided’s picture

Assigned: Unassigned » Permanently Undecided
Status: Active » Needs review
StatusFileSize
new972 bytes

Here's a patch that fixes this.

What was the problem?
Basically, the Drupal way is to name css identifiers with hyphens (-) and to never use underscores (_), even though according to the w3.org specification you can use both: In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-z0-9] and ISO 10646 characters U+00A1 and higher, plus the hyphen (-) and the underscore (_).

In order to follow the Drupal's css identifier naming guidelines, all the names were sanitized using the function views_css_safe() that substitutes underscores with hyphens. However, instead of doing this for css class names only, this was also done for actual field names, which caused the bug.

My patch adds a new variable that holds the sanitized field name to use with css classes, and keeps the correct, unsanitized field name to use with, obviously, fields.

merlinofchaos’s picture

Status: Needs review » Fixed

Thanks for the patch, PU! Applied. Sorry about the delay, the holidays have had me quite busy.

Anonymous’s picture

Status: Fixed » Closed (fixed)