Daily block

shunshifu - February 21, 2009 - 23:41
Project:Daily
Version:6.x-1.1
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Ok I've been struggling with how to accomplish this using views so I finally resorted to a feature request. Maybe someone can point me in a direction I'm not seeing.

What I want is a block that will show the teaser of the daily content.

For my purposes what I am trying to do is to embed a daily content into a widget using the embed widgets module. Since the content in my daily content is a video this makes for a pretty big widget.

I've tried playing around with views to create a block but of course all I end up with is a block that shows the teaser of the container itself, not the content that is displayed daily.

I hope I'm making sense here.

So anyway my thinking is that if the daily module also put out a block showing the teaser of the daily content then things such as this could be accomplished.

Or maybe there's a way that I am not seeing.

Thanks for any input.

Phil

#1

EvanDonovan - April 22, 2009 - 15:56
Status:active» needs review

You could try this (untested) code (adding it to daily.module):

<?php
function daily_block($op = 'list', $delta = 0, $edit = array()) {
switch (
$op) {
   case
'list':
    
$blocks[0]['info'] = t('Daily content');
     return
$blocks;
   case
'view':
    
$tid = 34; // enter the tid of your daily vocabulary here
    
$nr = 0; /* Use -1 for the last item, -2 for the last-but-one item, etc; use 1 for the first item, 2 for the second item, etc; use 0 for a random item refreshed once a day */
    
$daily_node = _daily_node_by_tid($tid, $nr);
     if(
is_object($daily_node)) { $daily_node = node_view(_daily_node_by_tid($tid, $nr), $teaser, FALSE); }
    
$block['subject'] = t('Daily content');
    
$block['content'] = $daily_node;
     return
$block;
  }
}
?>

#2

shunshifu - June 16, 2009 - 22:14

I'll give it a shot and report back soon

Phil

 
 

Drupal is a registered trademark of Dries Buytaert.