Embedding Forward in custom themed nodes

iteego - June 10, 2009 - 05:48
Project:Forward
Version:6.x-1.7
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Greetings,

Since all of my nodes are custom themed the Forward link is not appearing. What is the code snippet I need to add to the node source code to get the Forward link and form to appear? I tried doing a search in the issues and did not find it. My apologies if this has already been addressed. Cheers, Kevin

#1

seanr - June 10, 2009 - 21:11

Even in custom themed nodes, you should still be outputting the $links variable somewhere. Here is code that should respect most of the forward settings, if you need to do it separately from the $links variable:

<?php
$type
= (variable_get('forward_link_type', 0)) ? node_get_types("name", $node) : 'page';
print
l(t(variable_get('forward_link_title', 'Email this !type'), array('!type' => $type)), 'forward', array('query' => 'path=node/'.$node->nid));
?>

Of course, you can pare that down quite a bit if you don't need the admin settings to be respected. The main thing is link path is 'forward' and the query string needs to be in the format 'page=path/to/any/page'. So this'd be the simplest version:

<?php
print l(t('Email this page'), 'forward', array('query' => 'path=node/'.$node->nid));
?>

#2

seanr - June 10, 2009 - 21:12
Status:active» fixed

#3

iteego - June 11, 2009 - 03:48

thank seanr,

that's just what i needed. also, is there a variation on that snippet for using the embedded expanding form instead of linking to another page with the form? cheers, Kevin

#4

iteego - June 11, 2009 - 03:57

I did want to mention that of course I have configured the settings in admin to use form instead of link. However, this code only permits usage of link if i'm correct? cheers, kevin

#5

seanr - June 11, 2009 - 18:58

If you have forward set to show the form, then you should be able to just print $node->content['forward'] in your theme.

#6

iteego - June 12, 2009 - 08:59

that doesn't work. I just get the word Array as output.

#7

seanr - June 12, 2009 - 15:03

Sorry, should be $node->content['forward']['#value'].

#8

iteego - June 13, 2009 - 06:16

Thanks. This is really STRANGE but it works in Firefox but not IE. How could that be???

#9

iteego - June 13, 2009 - 07:03

Sorry, I'm a real dolt. That was just a permissions issue. It works perfect. Thanks

#10

System Message - June 27, 2009 - 07:10
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.