home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (calendar-month-node.tpl.php)

This example Drupal source code file (calendar-month-node.tpl.php) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

calendar, class, continuation, cutoff, div, endif, foreach, index, isset, monthview, php, variable

The calendar-month-node.tpl.php Drupal example source code

<?php
// $Id: calendar-month-node.tpl.php,v 1.5 2011/01/01 23:57:24 karens Exp $
/**
 * @file
 * Template to display a view item as a calendar month node.
 * 
 * $node 
 *   A node object for this calendar item. Note this is
 *   not a complete node object, but it will have $node->nid
 *   that you can use to load the full object, and
 *   $node->type to tell the content type of the node.
 * 
 * $fields
 *   An array of information for every field selected in the 'Fields'
 *   section of this view, formatted as requested in the View setup.
 * 
 * Calendar info for this individual calendar item is in local time --
 * the user timezone where configurable timezones are allowed and set,
 * otherwise the site timezone. If this item has extends over more than
 * one day, it has been broken apart into separate nodes for each calendar
 * date and calendar_start will be no earlier than the start of
 * the current day and calendar_end will be no later than the end
 * of the current day.
 * 
 * $calendar_start - A formatted datetime start date for this item.
 *   i.e. '2008-05-12 05:26:15'.
 * $calendar_end - A formatted datetime end date for this item,
 *   the same as the start date except for fields that have from/to
 *   fields defined, like Date module dates. 
 * $calendar_start_date - a PHP date object for the start time.
 * $calendar_end_date - a PHP date object for the end time.
 * 
 * You can use PHP date functions on the date object to display date
 * information in other ways, like:
 * 
 *   print date_format($calendar_start_date, 'l, j F Y - g:ia');
 * 
 * @see template_preprocess_calendar_month_node.
 */
$index = 0;
?>
<div class="view-item view-item-<?php print $view->name ?>">
  <div class="calendar monthview">
    <?php print theme('calendar_stripe_stripe', array('node' => $node)); ?>
    <div class="<?php print $node->date_id ?> contents">
      <?php foreach ($fields as $field): ?>
        <?php if ($index++ == 0 && (isset($node->continuation) && $node->continuation)) : ?>
        <div class="continuation">&laquo;</div>
        <?php endif;?>
        <div id="<?php print $field['id']; ?>" class="view-field view-data-<?php print $field['id'] ?>">
          <?php if ($field['label']): ?>
            <div class="view-label-<?php print $field['id'] ?>"><?php print $field['label'] ?></div>
          <?php endif; ?>  
          <?php print $field['data']; ?>
        </div>  
      <?php endforeach; ?>
    </div>  
    <?php if (isset($node->continues) && $node->continues) : ?>
    <div class="continues">&raquo;</div>
    <?php else : ?>
    <div class="cutoff">&nbsp;</div>
    <?php endif;?>
  </div>    
</div>

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal calendar-month-node.tpl.php source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.