Hi,
I need to insert a CCK node based on an automatic script that executes every X minutes, this script should insert a CCK node with values taken from other source.
Is there a CCK API or something to insert these values from plain PHP file?
Or do you know a better solution?
Thank you!
Leandro
Comments
Comment #1
chrisv-1 commentedThis one definitely needs some documentation!
The following code inside of a module seems to work for CCK textfields (but I don't know whether it is really the "right" approach):
In this example, there are three CCK textfields named "topic", "subtitle" and "author"; content type is "blog". Note that the double array around the CCK values is absolutely necessary, otherwise only the first character of the string will be stored (even if the fields are single-value only).
Comment #2
elwieneko commentedThis works fine for me, but once I try to create a nodereference or userreference it doesn't anymore. The data in these fields is not saved and worse no error is shown!
I used the following code
Any ideas or suggestions?
Comment #3
elwieneko commentedOk, maybe somebody might find this relevant in the future:
I looked at the POST request that Drupal receives via the wonderful Trace module. It turns out that the format of references differs from other content types.
This line worked for me:
The main differences are that
Happy coding,
Lars
Comment #4
karens commentedClosing old issues. None of us is using the D5 version any more, so hard to provide any support. Sorry.