Closed (fixed)
Project:
InsertNode
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
8 Aug 2009 at 17:00 UTC
Updated:
30 May 2010 at 23:50 UTC
I have a node storing details of a book, with fields for the book title, author, ISBN and price. I can insert the title easily, eg. [node:book22 title], but I'd like to be able to insert data from other fields, such as the price, eg. [node:book22 price] where "price" is the price field. This may straightforward for certain field types (text, integer, date), but could be problematic for more complex field types.
A useful option would be to be able to specify a span class for the data. eg. <span class="cash">[node:book22 price]</span>
Comments
Comment #1
AlexisWilke commentediantresman,
Would something like [node:book22 cck=price] work for you? That way we can make sure that there is no clash with the name of the field. As for how to render the field, there are theme(...) calls we can do to make that work.
Thank you.
Alexis Wilke
Comment #2
iantresman commentedThe syntax doesn't matter, but [node:book22 cck=price] would be fine. And I assume that theming is optional.
Comment #3
AlexisWilke commentediantresman,
Okay, there is a first version checked in. You should see the -dev change to Aug 8, test that version and see what it does.
Note that there is no reason for me to directly render the raw data. Plus, the raw data can really be anything so I don't see how I could do that...
But of course, you are free to have a look and submit a patch for even more extended support.
IMPORTANT: The syntax requires a semicolon as in:
[node:book22 cck=price;]Otherwise the '=value' does not take.
Thank you.
Alexis Wilke
Comment #4
AlexisWilke commentedThis supports any CCK type.
The display follows whatever is defined in the CCK display setup area.
Thank you.
Alexis Wilke
Comment #5
iantresman commentedWow that was quick, I'll check it out tomorrow as I'm away all day today.
Comment #7
iantresman commentedI've created a new content type for books, and added one new field "cost" which holds a decimal value.
The following works fine:
Item: [node:* cck=title;]However:
Item: [node:* cck=cost;]give a warning message:
Node #62 is being inserted twice by InsertNode. Breaking the recursive loop here.Comment #8
iantresman commentedAn interesting following on. I have defined a node #100 with one new CCK field "cost", contain the following:
If I include this node in another (eg. node #200) by adding
[node:100]then:I still get the error message above, but the behaviour is different. In the "cost" example, node #100 is working like a "macro", because it gets its data from the parent of the inserted note. This is powerful. I could create a "Paypal Button" node, and insert it into another node, to display the button with the parent node's data. Brilliant!
But it is odd that "cck=title" is not working in the same way, and does not appear to show the parent node's title, but the inserted node's title.
The ability to create node "macros" would be extremely powerful, and looks just a step away.
Comment #9
AlexisWilke commentediantresman,
I think that if you have the "recursive" error showing up, then you probably get the error when inserting the data the first time. Then the result it gets parsed again as if part of the parent node instead of the child node.
More or less, if you want to create a macro, it seems to me that you would need to not have the filter on the node being inserted (node with id 100.)
I will test to see whether what I'm saying here makes sense. But * is the current node and thus it would always be the "parent" most (or root) node and that is what I use for both, a standard CCK field and the "cck=title;" field.
Finally, it seems to me that the cost field should be referenced as: field_cost and not just plain cost.
Thank you.
Alexis
Comment #10
AlexisWilke commentediantresman,
Did the field_cost resolve your problem?
At this point, I'll mark this issue as fixed. If you still have a problem, let me know.
Thank you.
Alexis