Drupal 6 Links & Includes
Creating a link with HTML attributes.
<?php
$attributes = array(
'attributes' => array(
'class' => 'css-clss',
'rel' => 'lightbox',
'title' => 'My Title',
'id' => 'unique-id',
),
);
$link = l($title, $link, $attributes);
?>Links with image.
<?php
$image = '<img src"' . $base_path . $directory .'/images/sample.png" />';
$attributes = array(
'html' => array(
'html' = TRUE,
),
); // also $attributes = array('html' = 'true');
$link = l($img, $address, $attributes);
?>Linking is even more important when you start needing to connect your module to other pieces of code.
Find the path to a module or file.
<?php
$type = 'module'; // Could also be 'theme' or 'profile'.
$name = 'that_other_modules_name';
drupal_get_path(%type, $name);
?>Include external files the Drupal way!
module_load_include($type, $module_name, $name_of_file)
<?php
module_load_include('inc.php', 'my_module', 'external_file');
?>- Log in to post comments
