From 33c172943ddd2431773bbdb3c4cd23fce295f8d5 Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 18 Jan 2009 22:32:30 +0000 Subject: added settings on num of entries to include and whether to include the post date --- views/default/widgets/feed_reader/edit.php | 49 ++++++++++++++++++++++++++++++ views/default/widgets/feed_reader/view.php | 41 +++++++++++++++++-------- 2 files changed, 77 insertions(+), 13 deletions(-) diff --git a/views/default/widgets/feed_reader/edit.php b/views/default/widgets/feed_reader/edit.php index 3b14dcc97..f74462135 100644 --- a/views/default/widgets/feed_reader/edit.php +++ b/views/default/widgets/feed_reader/edit.php @@ -1,4 +1,53 @@ +num_items; + if (!isset($num_items)) $num_items = 10; + + $excerpt = $vars['entity']->excerpt; + if (!isset($excerpt)) $excerpt = 0; + + $post_date = $vars['entity']->post_date; + if (!isset($post_date)) $post_date = 0; + +?> +

+ +

+ + + 'params[num_items]', + 'options_values' => array( '5' => '5', + '8' => '8', + '10' => '10', + '12' => '12', + '15' => '15', + ), + 'value' => $num_items + )); +?> +

+ +

+ 'params[excerpt]', 'js' => 'id="params[excerpt]"', 'value' => $excerpt )); + echo ""; + echo ' ' . elgg_echo('simplepie:excerpt'); +?> +

+ +

+ 'params[post_date]', 'js' => 'id="params[post_date]"', 'value' => $post_date )); + echo ""; + echo ' ' . elgg_echo('simplepie:post_date'); +?> +

diff --git a/views/default/widgets/feed_reader/view.php b/views/default/widgets/feed_reader/view.php index b640890d2..300c56ec7 100644 --- a/views/default/widgets/feed_reader/view.php +++ b/views/default/widgets/feed_reader/view.php @@ -9,29 +9,44 @@ $feed_url = $vars['entity']->feed_url; if($feed_url){ - $feed = new SimplePie($feed_url); + $excerpt = $vars['entity']->excerpt; + $num_items = $vars['entity']->num_items; + $post_date = $vars['entity']->post_date; + + echo $feed_url; + $feed = new SimplePie(); + $feed->set_feed_url($feed_url); + //$feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_ALL); + $feed->init(); $feed->handle_content_type(); - - +echo $post_date; + echo $feed->get_item_quantity(); +?> +

get_title(); ?>


+ $feed->get_item_quantity()) + $num_items = $feed->get_item_quantity(); + + foreach ($feed->get_items(0,$num_items) as $item): ?> -

get_title(); ?>

- get_items() as $item): - ?>
-

get_title(); ?>

-

get_description(); ?>

-

Posted on get_date('j F Y | g:i a'); ?>

+

get_title(); ?>

+ ' . $item->get_description(true) . '

'; ?> + +

Posted on get_date('j F Y | g:i a'); ?>

+
+ ' . elgg_echo('simplepie:notset') . '

'; } ?> + + -- cgit v1.2.3