Possible to change the location of the Watcher "This post is being watched" DIV within the node?

mherchel - June 9, 2008 - 14:00
Project:Watcher
Version:5.x-1.3
Component:Documentation
Category:support request
Priority:minor
Assigned:Unassigned
Status:closed
Description

Hi,

First of all, I'd like to say that your module is great. I'm having one minor issue, however. I've read through the Readme.txt, but can't seem to figure this out.

Is it possible to change the location of the watcher div in the node? Is there any way that I can call the watcher function in my node-forum.tpl.php using PHP print function or any other way? If so, how do I do this?

Any help would be greatly appreciated! Thanks!

#1

solipsist - June 10, 2008 - 10:19

Try this:

       <?php if($node->content['watcher']['#value']): ?>
          <div class="node_watcher">
            <?php print $node->content['watcher']['#value']; ?>
          </div>
       <?php endif; ?>

Now the same value is in the $content variable so you'll have to display the body field separately as well:

    <div class="content">
    <div class="content_description"><?php print $node->content['body']['#value']; ?></div>
    </div>

#2

solipsist - July 17, 2008 - 09:38
Status:active» closed

#3

fuquam - January 22, 2009 - 17:59

Can there be a way to select the position in the watcher settings much like the "print-friendly" module. Ideally it would be nice to have the "watcher" positioned in the node footer with the "add comment" and "print-friendly" links. Great module though.

#4

solipsist - January 22, 2009 - 20:10

fuquam: Please do not reuse issues, it just makes it much harder for me to keep track of outstanding issues so I can fix/implement them. Instead, create a new one and refer to the old. While similar, your question and the original poster's are not the same, they're merely related.

Your suggestion is already on my todo list for Watcher. It'll be implemented as soon as possible.

Thanks for your feedback.

#5

gagarine - April 27, 2009 - 07:49

Hello,
Solution in #1 work great but the CCK field is not displaying any more. How can I simply disable the output in the node content?

#6

gagarine - April 27, 2009 - 08:01

Ok i have a Quick (certainly dirty) solution.

I hack the function _watcher_node_watch_link and in line 20140 i replace

<?php
  $node
->content['watcher'] = array(
   
'#value' => theme('watcher_node_toggle_watching_link', $user->uid, $node->nid, $dest, $watching, $tstrings),
   
'#weight' => 30,
  );
?>

by
<?php
  $node
->watcher['toggle'] = array(
   
'#value' => theme('watcher_node_toggle_watching_link', $user->uid, $node->nid, $dest, $watching, $tstrings),
   
'#weight' => 30,
  );
?>

So the watcher toggle are not displaying in the content of the node.

After that, to display the watcher toggle I add this line in my node.tpl.php

<?php
echo $node->watcher['toggle']['#value'];
?>

#7

Macarro - October 28, 2009 - 10:06

I'm not sure but I think is better to override that function in your template.php file than hack the module. This way you'll keep your modification while updating the module.

The other solution visually clean is to hide the watcher icon in the content using CSS. But you'll still have two watcher in the back.

Another point, if you use

<?php
print $node->content['body']['#value'];
?>

to print the node's content without watcher links you can get some issues with other modules. In my case I'm using "inline" filter to show uploaded files and they are not rendered. Instead I get the plain text (i.e. [inline:picture.jpg]).

So, for me, the best current solution is to put the watcher link wherever you want in your node.tpl.php and hide the original one using CSS. In the future, when the module allows you to modify the watcher position, hide it, etc... you can "clean" your template simply deleting a couple of lines in your CSS.

Kind regards.

 
 

Drupal is a registered trademark of Dries Buytaert.