Hi,

I want to remove automatically after updating to remove the txt .jpg from the title of a node.
Therefore i use the following code.

$body_values = field_get_items('node', $node, 'title');
$value = $body_values[0]['value'];
print(str_replace('.jpg','',$value,1));

I gives a error: Only variables can be passed by reference

What can I do to make this happen?

Comments

justme2013’s picture

Solution to this is:

$tmp = str_replace(".jpg"," ",$node->title);
$tmp = str_replace(".JPG"," ",$tmp);
$node->field_imageiy[$node->language][0]['title'] = $tmp;
$node->title = $tmp;
node_save($node);

TR’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

The original poster seems to have figured out the problem ...