Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
justme2013 CreditAttribution: justme2013 commentedSolution 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);
Comment #2
TR CreditAttribution: TR commentedThe original poster seems to have figured out the problem ...