By drupal92037 on
I created a CCK content type with several text fields:
field_book_title
field_book_author
field_book_publisher
etc...
I have the "automatic nodetitles" module automatically generating titles for me. Is there a way for me to have it use a CCK field value from that node? I tried entering [field_book_title] in the title pattern field, and it doesn't work. It just literally prints "[field_book_title]" as the title, including the square brackets.
Help!
Comments
Do you have the Token module
Do you have the Token module installed? If not, give it a go.
I have the token module
I have the token module installed, and get the same problem
Use PHP
Automatic nodetitles can be somewhat problematic sometimes with CCK fields and tokens, but using PHP can get around it. Here's an example:
Obviously change the name of the field to whatever yours is, and don't forget to tick the "Evaluate PHP in pattern" box! I seem to forget every so often then get confused calls from clients ;-)
thanks for your response. It
thanks for your response.
It actually works in some cases without the php, for example with [author-name].
However, what I want to do is grab a cck field from another content type. In this case it doesn't even work with php. Does referencing have anything to do with it?
I believe [author-name] would
I believe [author-name] would be more consistent since it's not a CCK field, so PHP might not be necessary there.
Are you referencing the content type that contains the field you'd want to include in the automatically generated title? You may then have to load that node using the referenced nid to get at the info you'd want included.
well not sure how to achieve
well not sure how to achieve that effect.
I have a node limit, so only one node of the content type I want to use can be created. The title of this node should then used as the title in the automatic generation.
any suggestions on php?
well not sure how to achieve
well not sure how to achieve that effect.
I have a node limit, so only one node of the content type I want to use can be created. The title of this node should then used as the title in the automatic generation.
any suggestions on php?
Snippet
This should work for you. Just make sure that you tick the box that says "Evaluate PHP in pattern" in your Automatic Title Generation fieldset.
Make sure you change field_node_reference_field to the name of your node reference field.