Title replacement isn't working

dodazzi - January 12, 2007 - 09:47
Project:Automatic Nodetitles
Version:5.x-1.x-dev
Component:Miscellaneous
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I installed auto-nodetitle module and the token module but I haven't been able to have them working.
1. Do I have to wrap token values in special characters? ( what do I have to type in the pattern textarea to print the node id as title? ( nid, [nid], %nid or what?) )

anyway whatever I type on the pattern textarea (I tried some php code too) I'm having this error on node preview:

warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/homeslee/public_html/drupal/includes/bootstrap.inc on line 589.

Any help appreciated.

#1

dodazzi - January 12, 2007 - 09:58

Ok, I tried with square brackets and it works but I'm still having the warning on node preview (On submission the automatic title is correctly inserted).
And there are some problems with CCK date and node reference fields that aren't printed at all.

#2

fago - January 13, 2007 - 20:04

What's your configuration for the automatic-title?

I've just fixed one issue I ran over with the node-preview (node->changed unset)

#3

dodazzi - January 13, 2007 - 20:38

drupal RC 1
CCK 5.x-1.x-dev
automatic node-titles 5.x-1.x-dev
token 5.x-1.3

I enable automatic title for a CCK content type and then define a pattern like :

[field_venue] [field_date] [field_artist]

field_date is a CCK datefield,
field_artist is a nodereference field
and
field_venue is a textfield.
Only the textfield is correctly printed in the title field.
And whatever I use as pattern (even a simple string) I always have the error I mentioned above.

#4

creazion_dev - January 14, 2007 - 17:12

Subscribing :)

#5

Aren Cambre - January 14, 2007 - 21:36

Could these usage rules be documented somewhere? Nowhere do I see that you have to use square brackets to make this work.

#6

creazion_dev - January 15, 2007 - 08:45

Hi dodazzi,

I've the same problem. I think there can't be an nid because the node isn't saved at this time.

I use the following code snippet to get the nid:

<?php
print db_next_id('{node}_nid');
?>

IMHO there is only a problem if more than one user create a node at the same time

#7

dodazzi - January 15, 2007 - 14:06

I think the problem is caused by the token module.
I changed the function that generate the tokens for CCK fields and everythings seems to work now.
Please look at this post for instructions .

#8

fago - January 17, 2007 - 19:56

could you try again with the latest token module release?
http://drupal.org/node/110210

#9

Robrecht Jacques - January 24, 2007 - 18:04

I have a similar problem.

Drupal 5.0
Content 5.x-1.2
Date 5.x-1.0-beta
Number 5.x-1.2
Token 5.x-1.4
Automatic Nodetitles 5.x-1.x-dev

I have a content type where I would like a date inside the title, a date provided by CCK/Date and a number provided by CCK/Number. My configuration for auto_nodetitle is:

Booklet [field_number]: [field_date]

The number is substituted correctly. However, the [field_date] always is replaced by "January 2007", even if I put "12/2005" as value for the field. In the preview of the node, CCK correctly sets "December 2005" as the value, but that value is not used in the title.

It seems like the node is not complete when doing _auto_nodetitle_patternprocessor(). When CCK gets the node and does a content_format($field, $item) the $item contains:

Array
(
    [value] => 2005-12-00T00:00:00
    [timezone] =>
)

while when auto_nodetitle does (or lets token.module do) a content_format($field, $item) the $item contains:
Array
(
    [value] => 12/2005
)

Any help appreciated.

#10

fago - February 2, 2007 - 21:30
Status:active» fixed

I've just committed some enhancements, please test and reactivate if the problem persists.

#11

Anonymous - February 16, 2007 - 21:30
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.