Skip to content

Instantly share code, notes, and snippets.

@clrockwell
Created April 2, 2014 03:37
Show Gist options
  • Save clrockwell/016aa1ef173aee990b1c to your computer and use it in GitHub Desktop.
Save clrockwell/016aa1ef173aee990b1c to your computer and use it in GitHub Desktop.
Just templating a block; too much logic is in this one though, should maybe be moved to a preprocessor
<?php
shuffle($nodes);
?>
<div class="product-showcase-carousel">
<h2 class="block-title-custom">Product Showcase
<a href="product-showcase/create" class="smallh2"> + Create A Listing</a>
<span class="smallh2">/</span> <a href="product-showcase" class="smallh2">View All Listings</a>
</h2>
<div class="ps-nav ps-prev">Previous</div>
<div class="product-showcase-carousel-wrap">
<?php foreach ($nodes as $psNode) {
// @todo should this be moved to template.php?
$img = field_get_items('node', $psNode, 'field_image');
$company = field_get_items('node', $psNode, 'field_company');
$body = field_get_items('node', $psNode, 'body');
$title = check_plain($psNode->title);
$path = drupal_get_path_alias('node/' . check_plain($psNode->nid));
$img = field_view_value('node', $psNode, 'field_image', $img[0]);
$imgVars = array(
'style_name' => 'product_showcase_thumbnail',
'path' => $img['#item']['uri'],
);
$img = theme('image_style', $imgVars);
$company = field_view_value('node', $psNode, 'field_company', $company[0]);
$body = field_view_value('node', $psNode, 'body', $body[0]);
// var_dump($img, $company, $body, $title, $path);
// die();
?>
<div class="ps-carousel-item">
<div class="ps-carousel-img"><?php print $img; ?></div>
<div class="ps-carousel-copy">
<span class="ps-carousel-copy-company"><?php print render($company); ?></span>
<!-- <span class="ps-carousel-copy-title">
<a href="<?php print $path; ?>"><?php print $title; ?></a></span>
</span> -->
<span class="ps-carousel-copy-body fade">
<?php print render($body); ?></span>
</span>
<span class="ps-read-more"><a href="<?php print $path; ?>">Read More</a>
</div>
</div>
<?php } ?>
</div>
<div class="ps-nav ps-next">Next</div>
</div>
<?php //drupal_add_js(path_to_theme() . '/js/plugins/carouFredSel/jquery.carouFredSel-6.2.1-packed.js'); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment