php - Multifeeds in simplepie, how to distinguish categories -



php - Multifeeds in simplepie, how to distinguish categories -

i have multifeeds project created simplepie. runs fine want can't accomplish , haven't found tutorial regarding how it. project consists on news aggregator various categories arrays of links each one. have setup 2 test pages explain better: 1st:http://goo.gl/0e3kqu 2nd:http://goo.gl/yo1mtv

on first illustration each category separated , has different border-bottom color (3 simplepie instances):

<?php require_once('../inc/autoloader.php'); $feednews= new simplepie(); $feednews->set_feed_url(array('feed1', 'feed2','feed3',)); $feednews->init(); $feednews->handle_content_type(); $feedentertain= new simplepie(); $feedentertain->set_feed_url(array('feed4','feed5','feed6',)); $feedentertain->init(); $feedentertain->handle_content_type(); $feedtech= new simplepie(); $feedtech->set_feed_url(array('feed7','feed8','feed9',)); $feedtech->init(); $feedtech->handle_content_type();

?>

<ul> news <?php foreach ($feednews->get_items() $item) : ?> <div> <span class="news"> <span class="title"><a target="_blank" href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></span> - <span class="source"><?php $feednews = $item->get_feed(); echo $feednews->get_title(); ?></span> <span class="date"><?php echo $item->get_date("h:i a"); ?></span> </span> </div> <?php endforeach; ?> </ul> <ul> amusement <?php foreach ($feedentertain->get_items() $item) : ?> <div> <span class="entertain"> <span class="title"><a target="_blank" href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></span> - <span class="source"><?php $feedentertain = $item->get_feed(); echo $feedentertain->get_title(); ?></span> <span class="date"><?php echo $item->get_date("h:i a"); ?></span> </span> </div> <?php endforeach; ?> </ul> <ul> tech <?php foreach ($feedtech->get_items() $item) : ?> <div> <span class="tech"> <span class="title"><a target="_blank" href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></span> - <span class="source"><?php $feedtech = $item->get_feed(); echo $feedtech->get_title(); ?></span> <span class="date"><?php echo $item->get_date("h:i a"); ?></span> </span> </div> <?php endforeach; ?> </ul>

on sec followed simplepie tutorial called how_to_group_multiple_posts_by_day (merging multiple feeds), , grouped (1 simplepie instance):

<?php require_once('../inc/autoloader.php'); $feed_genre['news'] = array('feed1','feed2','feed3',); $feed_genre['entertain'] = array('feed4','feed5','feed6',); $feed_genre['tech'] = array('feed7','feed8','feed9',); extract($feed_genre); $feedall = new simplepie(); $feedall->set_feed_url(array_merge((array)$news, (array)$entertain, (array)$tech)); $feedall->init(); $feedall->handle_content_type(); ?> <?php $stored_date = ''; $list_open = false; foreach ($feedall->get_items() $item): { $item_date = $item->get_date('f d'); ?> <?php if ($stored_date != $item_date) { if ($list_open) { echo '</span>' . "\r\n"; } $stored_date = $item_date; echo '<div class="">' . '<span class=""> ' . $stored_date . ' </div>' . "\r\n"; echo "\r\n"; $list_open = true; }} ?> <?php { ?> <ul> <div> <span class="title"><a target="_blank" href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></span> <span class="source"><?php $feedall = $item->get_feed(); echo $feedall->get_title(); ?></span> <span class="date"><?php echo $item->get_date("g:i a"); ?></span> </div> </ul> <?php } ?> <?php endforeach; ?>

what want is:

mix them all, grouped day (as in 2nd page). style each category color (as in 1st page).

i hope have explained myself clear, thanks.

php simplepie

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -