Hi - so glad I found this module, seems like what I need after days of fooling around with TokenNodeToken and Tokenize. Mainly I need the sitewide tags functionality.

However I have hit a roadblock: most of my CCK content types have custom templates defined using the Contemplate module, which lets you override the default construction of the node content that gets passed to the theme. It seems like when Contemplate is enabled for a content type, the replacement doesn't work - if I disable Contemplate for that content type, the replacements start working. But it's not an option for me to stop using Contemplate, I rely on it too heavily.

I'm imagining it has something to do with when in the pipeline the replacements are actually happening, but I don't understand the internals of Contemplate well enough to see what the problem is.

Seems like this is the same issue as posted here:
http://drupal.org/node/258441 - the original poster ended up saying there really was no problem, but it seems like a problem to me!

I'd appreciate any help you could provide...

CommentFileSizeAuthor
#10 reptag_contemplate.patch7.36 KBprofix898

Comments

profix898’s picture

I will need to take a look at contemplate, but I guess the problem is the ambiguity of cck field in terms of $node->field versus $node->content['field']. Try to print out the whole $node object (e.g. print_r($node);). I think you will find one field processed and one not ... Let me know if that helps or you need assistance.

laken’s picture

Ok, I think we're on to something here. In my Contemplate template I use: $node->field_question[0]['view'] which contains:

<p>Here's some regular node text</p> 
<p>here's my reptag: $MY_TAG$</p> 

so this one is not getting processed. However, $node->content['field_question']['#value'] contains:

<div class="field field-type-text field-field-question"><div class="field-label">Question:&nbsp;</div><div class="field-items"><div class="field-item"><p>Here's some regular node text</p> <p>here's my reptag: 140</p> </div></div></div>

so the reptag is being replaced there - but that value contains the default CCK formatting (lots of extra divs and labels like "Question" which I don't want) and defeats the purpose of using Contemplate.

So the question may be, how can the tags be replaced so they show up in the $node->field values...

Any ideas? I really appreciate this module's features and your willingness to help. It seems it would benefit many people if this CCK issue could be solved...

laken’s picture

Looking at the code, I think the issue may be in the way that reptags forms, stores, and retreives the fields to be processed. I don't claim to grok every aspect of this code, but in line 457 (and similarly in line 437) of reptag_admin.inc you have:

$field_path = 'content/'. $field .'/#value';

which seems imply the replacement will take place only in the $node->content['field'] versions, not in the $node->field versions. Would it be easy to add support for the $node->field versions of the fields?

I must admit I don't totally understand what the function is of these two parallel data structures that CCK is creating, so I may be off base...

laken’s picture

I asked

Would it be easy to add support for the $node->field versions of the fields?

Well, I tried something that worked:

The CCK field I need replaced is field_question[0]['view']

I hard-coded this to see if it would work, inserted between lines 209 and 210 of reptag.module:

    $fields[] = 'field_question/0/view';

And it worked: the tag is correctly replaced.

Hoping this helps figure out how to add support for the $node->field_ fields.

summit’s picture

Subscribing, greetings, Martijn

laken’s picture

nudge :-)

laken’s picture

sorry - nudged twice by mistake...

laken’s picture

Category: support » bug
laken’s picture

Thilo, I wonder if you could take a look at this issue. Doesn't seem like it would take much to get this working, and it has me at a standstill with the site I'm developing for my client.

I'm sure other people who use Contemplate module would really appreciate being able to use Reptags as well!

Thanks in advance for your help!

profix898’s picture

Status: Active » Needs review
StatusFileSize
new7.36 KB

The whole node rendering concept is a mess ... I really hope for Drupal 7 to clean this up ...
However, attached is a patch that should solve the problem with contemplate for now. Can you please apply the patch, run update.php and check the node output? Please verify that update.php migrates the field settings to the new syntax correctly by looking at the settings on admin/settings/reptag/admin/content.

laken’s picture

Status: Needs review » Fixed

Apologies for the very late reply - I was in the middle of a cross-country move when you posted and missed it!

This patch (which I think has been committed to subsequent releases) solved the problem beautifully, and I'm very grateful!

Thanks for a terrific module and responding to my requests! I have had mixed experiences filing bugs on contrib modules (often they are just ignored) and when I'm deep in development on a site it and you come through with a fix like this, I feel supported by the Drupal community.

We really like reptag and haven't found anything else to match its smooth interface.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.