--- In [email protected], "radiantgx" <radian...@...> wrote:
>
> > I have tried the php "array_reverse" function, which did reverse them, but
> > didn't happen to put them in alphabetical order.
> >
> > I have tried adding the following line to the file that calls the feed:
> > $feed->order_by_date(false);
> >
> > If anyone could help me out with this, I would sincerely appreciate it.
>
>
> The code you are referring to should be:
>
> $feed->enable_order_by_date(false);
>
> Post the code you used to build your array... that way we can see where you
> might have gone wrong. If its a lot of code then use PasteBin.com
>
> By default SimplePie orders everyting by post date so if you want to
> alphabetize posts by title then you have to build an array listed by the
> $item->get_title() data and then sort it with php's sort($array) function.
>
First of all, thank you for the reply! I think that this is more/less some
"default" code that comes with SP, but here it is:
-- start code paste --
require_once('/(path-remove-for-security)/simplepie.inc');
header('Content-type:text/html; charset=utf-8');
$feed = new SimplePie();
$feed->set_feed_url('http://feeds.delicious.com/v2/rss/ibgmedia/domains?count=100');
$feed->enable_order_by_date(false);
$feed->init();
echo '<div class="newsblocksfeed">';
echo '<ul>';
// Limit the items to be shown
$i = 1;
foreach($feed->get_items() as $item){
if($i<100){
echo '<li><a href="'.$item->get_permalink().'"
target="_blank">'.$item->get_title().'</a><br />'. "\n";
$i++;
}
}
echo '</ul>';
echo '</div>';
-- end code paste --
So if I read your response correctly, I will need to add something to this to
get and then sort the array of values? I am not a PHP programmer, but I can
kinda sorta see the logic when I look at it.
Unless of course, someone would be willing to help me out! This may benefit
others with the same challenge as well.
Any help is appreciated though.
Thank you.