Posts Tagged 'l'

Display HTML on Lightbox v2

I’m trying drupal 6.x from some weeks ago. On Drupal 5.x, I’ve used Greybox Redux module to display HTML content on a Javascript popup window. On 6.x, where Greybox isn’t available, I try successfully Lightbox v2. I use this module for images on many sites: syntax to display HTML on a popup IFRAME changes slightly:

<a rel="lightframe" http="http://example.com" title="Lightframe label">Link Text</a>

And this is the l() equivalent:

l('Link text', 'http://example.com', array('attributes' => array('rel'=>'lightframe', 'title'=>'"Lightframe label')))

You can also use the grouping feature to browse prev/next elements:

'rel'=>'lightframe[mygroup]'

customize display style:

'rel'=>'lightframe[|width: 800px; height: 600px;]'

both:

'rel'=>'lightframe[mygroup|width: 800px; height: 600px;]'

Complete example:

l('Link text', 'http://example.com', array('attributes' => array('rel'=>'lightframe[mygroup|width: 800px; height: 600px;]', 'title'=>'"Lightframe label')))

See also:

Get alias or system path: drupal_lookup_path

l function converts automatically system path in alias where available.

This simple snippet ports this useful function on your raw HTML attributes, point to alias or to the system path.

if(($nodepath = drupal_lookup_path('alias',"node/".$realnode->nid))===FALSE)
$nodepath =  base_path() . "node/".$realnode->nid;

Where $nodepath can be used on href

Cfr. drupal_lookup_path


IE6: Rust in Peace

Blog Stats

  • 102,275 hits
My Bookshelf

Texts double licensed under Creative Commons Attribution - Share Alike license and GNU Free Documentation License. Examples may contain software licensed under GNU General Public License. Images and comments texts aren't necessarily licensed under these terms.