aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Varesano <fax8@13637.no-reply.drupal.org>2006-04-23 03:36:35 +0000
committerFabio Varesano <fax8@13637.no-reply.drupal.org>2006-04-23 03:36:35 +0000
commit2e86ac1658ff1e097c755d34e5e0337137ba7c7f (patch)
treeb90765c0302166d44470a9b99b02314b0c59c8ce
parent71bf5a971da9f406545157b393fe1640d589344b (diff)
downloadvideo-2e86ac1658ff1e097c755d34e5e0337137ba7c7f.tar.gz
video-2e86ac1658ff1e097c755d34e5e0337137ba7c7f.tar.bz2
Patch #57216 by fax8 (Fabio Varesano): Added feed for video. It is available at ?q=video/feed . Also added feed icon at the bottom of ?q=video page.
-rw-r--r--video.module30
1 files changed, 30 insertions, 0 deletions
diff --git a/video.module b/video.module
index 0b397bd..1ff71c0 100644
--- a/video.module
+++ b/video.module
@@ -136,6 +136,12 @@ function video_menu($may_cache) {
'access' => user_access('access video'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array(
+ 'path' => 'video/feed',
+ 'title' => t('videos feed'),
+ 'callback' => 'video_feed',
+ 'access' => user_access('access video'),
+ 'type' => MENU_CALLBACK);
+ $items[] = array(
'path' => 'node/add/video',
'title' => t('video'),
'access' => user_access('create video'));
@@ -230,11 +236,35 @@ function video_page() {
$output .= node_view(node_load($node->nid), 1);
}
$output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+ // adds feed icon and link
+ drupal_add_link(array('rel' => 'alternate',
+ 'type' => 'application/rss+xml',
+ 'title' => variable_get('site_name', 'drupal') . ' ' . t('videos'),
+ 'href' => url('video/feed/')));
+
+ $output .= '<br \>' . theme('feed_icon', url('video/feed'));
}
return $output;
}
/**
+ * Generate an RSS feed for videos
+ *
+ * @return
+ * feed
+ */
+function video_feed() {
+ $channel = array(
+ 'title' => variable_get('site_name', 'drupal') . ' ' . t('videos'),
+ 'description' => t('Latest videos on') . ' ' . variable_get('site_name', 'drupal'),
+ 'link' => url('video', NULL, NULL, TRUE)
+ );
+
+ $result = db_query('SELECT n.nid FROM {node} n WHERE n.type = "video" AND n.status = 1 ORDER BY n.created DESC');
+ node_feed($result, $channel);
+}
+
+/**
* Permissions hook
*
* @return