Here is how I make weblinks open up in Lightbox2 (http://drupal.org/node/144469).

1. Of course, install and enable Lightbox2 module.

2. Add 2 identical code snippets to weblinks.module. The first instance is around line 403. The second instance is around line 1017. Just after this:

    if (variable_get('weblinks_nofollow', FALSE)) {
      $options['attributes']['rel'] = 'nofollow';
    }

add this

// Add lightbox2 lightframe display option
    if (variable_get('weblinks_lightframe', FALSE)) {
      $options['attributes']['rel'] = 'lightframe';
    }

3. In weblinks.admin.inc, just after this:

  // Add "rel=nofollow."
  $form['page']['weblinks_nofollow'] = array(
    '#type' => 'radios',
    '#options' => $yesno,
    '#prefix' => '<div class="weblinks-radios">',
    '#suffix' => '</div>',
    '#title' => t('Spam link deterrent'),
    '#default_value' => (int) variable_get('weblinks_nofollow', FALSE),
    '#description' => t('If enabled, Drupal will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.'),
    );

add this

// Add lightbox2 lightframe display option
  // Add "rel=lightframe."
  $form['page']['weblinks_lightframe'] = array(
    '#type' => 'radios',
    '#options' => $yesno,
    '#prefix' => '<div class="weblinks-radios">',
    '#suffix' => '</div>',
    '#title' => t('Lightbox2 popup display'),
    '#default_value' => (int) variable_get('weblinks_lightframe', FALSE),
    '#description' => t('If enabled, Drupal will add rel="lightframe" to all links to show the site in a Lightbox2 frame popup.'),
    );

4. I also changed the width of the lightbox to 900px in /admin/settings/lightbox2/html_content

Comments

colorado’s picture

Title: Added Lightbox2 Support » Added Lightbox2 Support - Continued...

The above will add a yes/no option (defaults to no) in /admin/settings/weblinks just under the Spam Link Deterrent (nofollow) option.

Let me know if you have any trouble.

colorado’s picture

Title: Added Lightbox2 Support - Continued... » Added Lightbox2 Support
nancydru’s picture

Quite interesting concept. I have alway sheard of using LightBox for images, how does it work with WebLinks? What is the value? How does it look?

colorado’s picture

Hello Nancy,

You can see here: http://coloradoweb.com/weblinks.

Values are:

1. it looks nice

2. keeps the visitor on my site (and my site is always in view just behind)

3. faster and easier for the visitor to quickly preview external links

4. make a slide show or presentation of external sites/links?

Thanks!

nancydru’s picture

Interesting. I'd like to see it with a bunch of links.

colorado’s picture

http://coloradoweb.com/weblinks (in the Computer Retailers group)

The slide show uses the native features in Lightbox2 from inside the node body of the weblink node.

Rino-1’s picture

@colorado,
Thanks for the feature. I like it a lot but I am not yet sure if I want to keep it. I want to give users the option to save a link to their favourits or to temporary store a page in a separate tab. If I view a picture in a lightbox, I get a link to the node or to the picture. The same way, I would like to have a link in the lightbox. Do you know how to get thet or is this something to ask in the Lightbox issue queue?

drupalusering’s picture

Hello, great idea!
There's one more feature that should be useful if possible to implement. I am using the above method to preview links and I want the caption to be the link to a website that is loaded into the lightframe, so that when user clicks the caption it would take them to the website in new tab. Anyone have a suggestion how to implement it dynamically?