Dear Forum,

I would like to build a link href that looks like this

Subscribe!!!

But if I do it using hook link it doesn't work at all. It creates a link that wants to go here

http://localhost/drupal-5.7/?q=JavaScript%3ASubscribe%28818%2C+76%2C993%...

which is of course no good!

Can anyone help me?

Thank you

David

Comments

stclaird’s picture

The link I can't get to work with hook_link!

<a href="JavaScript:Subscribe(1484, 608,1225,'Latest Be on GMTV opportunities','','');">Subscribe!!!</a>
stclaird’s picture

It was fairly obscure but after a bit of trial and error I passed it as an onclick

hope it helps someone else

/**
 * Implementation of hook_link().
 */
 function elertz_link($type, $node = 0, $main = 0){
 $img_elertz_merecat = drupal_get_path('module', 'elertz') .'/images/elertz_16x16.gif';
 $elertz_url_title = variable_get('elertz_url_title',"");
 $nid = $node-> nid;
 $elertz_subscription = variable_get('elertz_subscription_string',""); 
 $schema_id = variable_get('elertz_schema_id',"");
 $webmaster_id = variable_get('elertz_webmaster_id',"");
 $elertz_brand_id = variable_get('elertz_brand_id',"");
 

 
 $links = array();
  
  if ($type == 'node' && $node->type == 'story' || $node->type == 'page' || $node->type =='blog'  ) {
    if (arg(0) != 'story' || arg(1) != $node->uid) {
      $links['elertz_link_url'] = array(
        title' =>  t($elertz_url_title),
        'href' => "",
        'attributes' => array('onclick' => $elertz_subscription),
        'html' => TRUE,      
      );
    }