Friday 17 September 2010

Working on Student Alpha project - Drupal

This weeks best edition on Student alpha project. Working on Drupal Pressflow 6.19 installation
Requirement from costumer - WE want change default file name on Field field, of course content type is made by CCK.
Here how it looked from previous developers point of view ..

<?php if($node->field_package[0] != NULL): ?>
<span><a href="<?php print simplecdn_rewrite_url(base_path().$node->field_package[0]['filepath'], $append = TRUE, 'imagecache'); ?>">
Downloads</a></span>
<?php endif; ?>


And my Version on code, I,ve decide to enable field field description option on CCK, you should go to your_file_field manage field settings, select on Description -> enabled and them do a little on code .. here it is.


<?php if($node->field_package[0] != NULL): ?>
<span><a href="<?php print simplecdn_rewrite_url(base_path().$node->field_package[0]['filepath'], $append = TRUE, 'imagecache'); ?>">
<?php print $node->field_package[0]['data']['description']; ?></a&qt;</span>
<?php endif; ?>

As you can see I am printing out Description field value in form of associative array.

Happy Drupaling and coding

No comments:

Post a Comment