Advertising sustains the DA. Ads are hidden for members. Join today

Dynamic Bookmarklets to post content to external site

Last updated on
30 April 2025

We used this code to allow site administrators of www.heavenletters.org to select a series of quotations from one site and post it to another site for the creation of a calendar book. The code was placed into a block and the javascript below posted the required cck field data to the external site where the prepopulate module was installed.

<?php
$arg_0 = arg(0);
$arg_1 = arg(1);

  if ($arg_0 == 'node' && is_numeric($arg_1)) {
    $node = node_load($arg_1);
    if ($node->type == 'heavenletter') {
      $v1 = $node->title;
      $v2 = $node->field_heavenletter_[0]['value'];
    }
  }

?>

This link will allow you to select text from a page and have that text passed via the url to a cck text field. You will have to change the variables and url to suit your requirements.

<a href="javascript:u=document.location.href;t='<?php print $v1 ?>';p='<?php print $v2 ?>';s=window.getSelection();
void(window.open(%22http://godliners.org/node/add/quotes?edit[field_htitle][0][value]=%22+escape(t)+
'&edit[field_quote][0][value]='+escape(s)+'&edit[field_url][0][value]='+escape(u)+'&edit[field_publishnumber][0][value]='+escape(p),'_blank',
'width=900,height=500,status=yes,resizable=yes,scrollbars=yes')); ">Calendar It!</a>

Help improve this page

Page status: Not set

You can: