page_list page attribute download

Permalink
hi im trying to create a page attribute file download link on the page_list block.

echo '<a href="' .  $page->getAttribute('download')->getVersion()->getRelativePath() .' ">Download NOW</a>';


but i get this

Fatal error: Call to a member function getVersion() on a non-object

i cant seem to figure out whats wrong any ideas ?
thanks

teknojunkey
 
pvernaglia replied on at Permalink Best Answer Reply
pvernaglia
Try $c or $cobj in place of $page see if that gets what you are looking for.
teknojunkey replied on at Permalink Reply
teknojunkey
many thanks
<?php 
 if($cobj->getAttribute('download')) {
 echo '<a href="'. $cobj->getAttribute('download')->getVersion()->getRelativePath() .' ">Download file</a>';
}
?>