Reputation: 38795
In Drupal6, we can use l function to format a link, but how can we set it to a popup window?
Suppose the original code look like:
<?php echo l('product', 'product') ?>
Upvotes: 0
Views: 654
Reputation: 895
Opening a popup using window.open is not considered a good practice. You may try the lightbox module (http://drupal.org/project/lightbox2) for a better way of showing a popup.
However, if you do want to open a popup using window.open, the following should work -
Create the link with an id
<?php echo l('product', 'product', array('attributes' => array('id' => 'product-link'))); ?>
Add JavaScript (you can add it to your theme's JS file) -
$(document).ready(<br />
function() {<br />
$("#product-link").click(<br />
function(e) {<br />
openWindow(); // function for opening window<br />
e.preventDefault(); // Stop link from opening new page<br />
}
);
}
);
Upvotes: 1