The sample template.tpl.php included with CCK has callback code that, when used in PHPTemplate, generates a host of php "Invalid argument supplied for foreach()" warnings when phptemplate_field() and field.tpl.php gets copied to a custom template file.

The code reference is at the bottom of the function:

  return _phptemplate_callback('field_devices', $variables, 'field-'. $field['field_name']);

The reference as written causes phptemplate.engine, function _phptemplate_default() to generate PHP errors because it expects the third parameter ($suggestions) to be an array -- and the callback is passing a scalar.

Converting the Suggestion reference to pass an array resolves those warnings:

  return _phptemplate_callback('field_devices', $variables, array('field-'. $field['field_name']));

-juanfe

Comments

yched’s picture

Status: Active » Fixed

I don't know what is the version you're looking, but CCK 5--1.5 does have

_phptemplate_callback('field', $variables, array('field-'. $field['field_name']));

And tagging your issue with HEAD is probably not right (I _hope_ you're not using cck HEAD, it's D6 work-in-progrees code)

juanfe’s picture

Version: 6.x-1.x-dev » 5.x-1.5

Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)