I've been able to use contemplate to modify the display of my custom CCK content type. However, I'm not sure the name of the Abstract and Attachment fields, so currently I'm not able to display them. What field name do I use to Abstract and Attachments, respectively? Thanks for any tips.

Comments

jrglasgow’s picture

The attachments can be found at $node->files (array), to use this you can:

<?php
  foreach($node->files as $file){
    echo "<a href=\"".base_path().$file->filepath."\">".$file->filename."</a>";
  }
?>

If you are in the teaser section of contemplate the attachments aren't loaded by default you will need to load the files with the node_load() function shown below.

I assume by abstract you mean the teaser, in the body section of contemplate the teaser is not loaded by default, you need to load the node:

<?php
$this_node = node_load($node->nid);
echo $this_node->teaser;

?><br/>

If you want to display in the body the attachments, the teaser, then the node content:

<em>Attachments:</em><br/>
<?php
  foreach($node->files as $file){
    echo "<a href=\"".base_path().$file->filepath."\">".$file->filename."</a><br/>";
  }
?>
<em>Teaser:</em><br/>

<?php
$this_node = node_load($node->nid);
echo $this_node->teaser;

?><br/>
<em>Story:</em><br/>
<?php print $body ?>

When you load all the node information using node_load() remember you can use print_r() to view the entire node object.

js1’s picture

Thanks for the detailed reply.

jrglasgow’s picture

Status: Active » Postponed (maintainer needs more info)

Did this do the trick for you?

js1’s picture

Yes it did. Thanks, again!

jrglasgow’s picture

Status: Postponed (maintainer needs more info) » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.