Easiest way to get tokens of the curently viewed node?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
PlayfulWolf's picture

Hi,

Prehistory: I am struggling big time with built-in Drupal 7 node->comments system and decided to design my own using Entity/Reference modules.

One of the first and simple ideas I am trying is to put node add form in the node page directly with the help of Formblock module and pass the ID of that node into one of the fields (the one, where this formblock is located).

So, for this to work I need to get token of this viewed node, how?

I know, that EVA module uses similar principle, but I want to avoid using it for this task.

Comments

tokens

joshuautley's picture

You still look'n for guidance on this? Been busy with the holidays, so just getting to reply now.

If you have a test URL you can share that would be helpful. I usually use tokens in my views. Can you you use view to generate the pages you need or a block that's displayed below your nodes and pull in the tokens through views that way?

I understand you - you want

PlayfulWolf's picture

I understand you - you want to see what I have done. Bt the problem is that I am in the same position as 90% of the others in those groups - I am solving problem which is a bit beyond of my knowledge.

Currently I am working on my OG based project with node->comments, but in parallel also searching to overcome this limitation.

For now it seems that the easiest task would be to convert current 6.x-3.x branch of Nodecomments to Drupal 7, because I would build many of very common things from scratch.

drupal+me: jeweler portfolio

Audrius, I am not clear what

Bob Newby's picture

Audrius,

I am not clear what you are trying to accomplish that is not already available in D7.

The D6 nodecomment module's overview states:

"With this module comments can be full nodes. For every content type you can choose to use different content type as comment, or to continue using Drupal core comments.
Thanks to this module, comments can have fields, revisions, taxonomy, uploaded files, access control and anything else that comes from the goodness of nodeapi."

D7's core leverages the fields api, and every node type's associated comments take advantage of this, making the D6 nodecomment module more-or-less obsolete (AFAIK).

Navigate to "admin/structure/types/manage/[node-type]/comment/fields" and you will find what I am referring to.

I hope this helps,

Bob

Probably you are not reading

PlayfulWolf's picture

Probably you are not reading what I wrote - I am talking, that I want to overcome limitation, when discussion like forum discussion is made with mixed entities: nodes and comments. To overcome this you need to do lots of stuff just to get to basic functionality. One for example is to get "Add node" form on the same page of the node (for that I needed to pass some variables of current node) and many others. But for now I see that this is too much beyond my knowledge=speed of work.

The limitation of node-comment system is that i cannot build a view with nodes AND comments and many related ones. You have to think and invent various trciks to make something which takes into account initial forum posts AND replies to them, like: Make a list of posts and last replies next to them.

If you know how to do that - let me (us) know, you will earn astronomical amounts of gratitude. It is, I think, the task of the same complexity or even more as to convert Nodecomments to D7.

drupal+me: jeweler portfolio

Now I get it. I suggest, if

Bob Newby's picture

Now I get it. I suggest, if you're up for the learning curve, you learn how to use Page Manager and Panels along with Views. A great learning resource to start with are the short tutorials Johan Falk has done on NodeOne. See http://nodeone.se/sv/node/21.

Thank you, Bob. I am not that

PlayfulWolf's picture

Thank you, Bob. I am not that newbie, but my knowledge is too shallow in Panels/Ctools. Anyway, I try to avoid it everywhere I can because of its often too high complexity and use Context instead. Again - this is just a workaround type of task, as I do not want to involve heavy modules used mainly for presentation purposes, not for building data structure, for such a trivial task: display original posts and replies in one list (view). Mainly this is all I need wtih some minor extras. Right now I think to finish current project like it is and try to convert Nodecomments myself.

drupal+me: jeweler portfolio

Tokens

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week