Drupal Questions & Answers

Ask and answer Drupal related questions! No question too simple or complex!
emnzava's picture
Asked by on Sat 25th Jul 2009
Hi, I need help on hoe to use node_load as well as how to get variables to a node teaser.

Hi,
I need help on hoe to use node_load as well as how to get variables to a node teaser.
Am trying to create custom teaser and i came accross the following code online. Can somebody tell me how to use this trick to output my teaser? When you say variable_get, where are those variables called from? is it from a content type fields or you just call content type itself?

here is the code

<?php if(variable_get('sports',0) != 0) { ?>
<div class="box-2">
            <?php $node = node_load(variable_get('sports',0));
                                if (
$node->nid) {
                                   
$image = variable_get('featured_imagefield_2','');
                                   
$image = $node->$image;
                                   
$node->teaser = azam_v1_featured_2($node, NULL, '180');
                                   
                               
?>

<h1><a href=""><span>ffff</span></a></h1>
<div class="bottom">
<a href="<?php print url('node/'.$node->nid) ?>"><?php print theme('imagecache', variable_get('featured_imagecache_2',''), $image<a href="#fn1411254255587045bdd4fe5">0</a>['filepath'], $image<a href="#fn1411254255587045bdd4fe5">0</a>['alt'], $image<a href="#fn1411254255587045bdd4fe5">0</a>['title']) ?></a>
<h2><a href="<?php print url('node/'.$node->nid) ?>"><?php print $node->title ?></a></h2>
<?php print $node->teaser?>
</div><!—end of bottom—>
<?php } ?>
</div><!—end of box2—>
<?php } ?>

I’ve never use node load but am very curious to knoe about it. Please any help will be greatly appreciated.

Mnzava

Commenting on this Drupal Question is closed.