2 isaac Sep 04, 2004 10:48

EdB wrote:
{ // do this if truncated items do not get linked to the article $continued_text = "<em> (read more)</em>"; }
Okay well that's a bit embarrasing! I had a validation killing error in _magpierss.php - the big one. Way down towards the bottom I left a "close link" tag after the /em for the non-linked 'read more' text. (like :oops: dude). Anyway I edited the post above AND copied the correct version here for those into making things right. Validation is funny. Most of the time is doesn't matter if you get it wrong and it hardly ever matters if you get it right. Even so it's nice to think that some aspect of my world has been deemed "valid". I once had a CAT scan done and I saved the report because it said I had a normally shaped brain. I was proud of that report. :roll:
Hey I got an idea that's a teeny tiny step towards what Isaac (and others) have looked for: a way to re-feed a feed. Rather than do the cron job thing and always automagically post whatever came through your aggregator I'm thinking of something like this: You visit your site and see something cool on your feed reader. You open the link in a new window or a new tab and can't wait to blog about it on your blog. You come back to your site and click a "ReBlog This" link and - abracadabra - the snippet is fed into the back office as the beginning of a titled and linked post. You add your two bits... er... um... profound wisdom and post it on your blog. Good? Stupid? Get a Life? (Wow now it's time to play with Zfeeder!)
Hey EdB
Awsome plugin. Thanks so much for it. Really is quite slick.
Done any more??
Cheers gacjezv
Nope. I tried to move some of the labor involved in the rss hack off to tables and the back office, but I kept stumbling over the simple parts so I gave up. Then I thought about the reblog idea but couldn't make heads or tails of actually getting it done. I also tried getting the bugs out of "recent posts" and "recent comments" but they're both way smarter than me so I gave up on that too. So I decided I like skins! I took a bunch of the golden oldies (and a handful of recent ones) and made them be CSS/XHTML valid, work well in 5 different browsers at 1024 or 800 wide resolution, and made sure they are cool with NinetyTen. Including 3 new ones of my own I've got 24 skins just about ready for prime time.
Hey EdB, I ran this last night and found that a b2e blog I agregated updated immediately, whereas a Blogger (atom I expect) blog didnt update upon a page refresh....?
The code I used in the _main.php on my site is:
<div class="bSideItem">
<?php
require_once( dirname(__FILE__).'/rss_fetch.inc' );
?>
<h3>Read the Feeds <a href="http://magpierss.sourceforge.net/" title="MagpieRSS provides an XML-based (expat) RSS parser in PHP"><img src="http://gacjezv.com/b2blogs/skins/clean-rss/img/black_grey_magpie_news.gif" alt="MagpieRSS provides an XML-based (expat) RSS parser in PHP" width="80" height="15" border="0" /></a></h3>
<?php
$show_me = 2;
$url = "http://www.gacjezv.com/b2blogs/xmlsrv/rss2.php?blog=10";
$rss = fetch_rss($url);
require( dirname(__FILE__).'/_magpierss.php' );
?>
<?php
$show_me = 3;
$url = "http://redsultana.com/cellobella/index.rss";
$rss = fetch_rss($url);
require( dirname(__FILE__).'/_magpierss.php' );
?>
</div>
Do you have any thoughts on this? i.e. is there a refresh issue with Atom feeds? Is the order important?
I will play around and post what I discover.
Regards
gacjezv
You might consider looking to see if magpieRSS made a cache folder or not, but if one blog updates and another doesn't it seems odd to blame a cache. When reading through all of magpieRSS's text files you learn that it tries to make a cache folder if it can, then cache what it reads for an hour. When I was working on this I went to my web host to see if magpieRSS made up a cache folder and saw that it did not. At the time I thought "I should add one and see about easily incorporating it into the hack instructions" but never got a round tuit for that piece of the action. I should for the sake of server loading, but I haven't noticed any perceptible uptake in bandwidth consumption at the only site I use this feature on. I'm only looking at one feed and only posting one read so maybe that's part of why I don't see a bandwidth hit?
I suspect it has something to do with how Blogger feeds the world. It would sort of make sense for them to limit traffic by not updating feeds every time a post is updated - maybe just telling all the aggregators in the world "go away" instead of letting them all in to have a peek at content every second of the day. Keep in mind I'm no expert on this or any other topic! Have you noticed any frequency with which the Blogger blog gets updated? If for example you get your new content hourly no matter when the post was posted during the hour that would offer circumstantial evidence of Blogger locking the gates.
damn snazzy... with this, and a plugin for my mp3 player (iTunes) from [url=http://www.audioscrobbler.com/]audioscrobbler[/url], I'm able to have a sidebar item that has my most recently played music in it!
Check it out [url=http://pobox.com/~joehall/nqb2/]here[/url].
I made some modifications to _magpierss.php specific to displaying audioscrobbler feeds. [url=http://pobox.com/~joehall/nqb2/index.php/2005/01/08/last_fm]Here[/url] are the details.
I am a user of this great plugin/hack... but having seen the wonderful tool http://www.reblog.org/ reblog, I was wondering if the idea that EdB came up with earlier in this post was a potential??
i.e. use reblog to get a list of feeds and the content, then have a reblog "option" to post selected feed elements to the B2E back office for posting?
there is some WP and MT plugins developed and available in the released version. I wonder if any one is interested in pursuing a mod'd plugin for B2E?
Hope some one can? I cant I am a dunce PHP programmer....
Cheers gacjezv
this is a great plugin/hack - thank you SO much to edB and joe. :D
just wanted to let you know how much i appreciate it!
gacjezv,
I agree, it would be a wonderful plugin/mod.
I need this very badly. I am an programmer, but was trying to fix it for example with the use of tags. But it is much harder then it seems to be.
Everytime i thought i got it became a total mess.
I am still trying, but maybe somebody can give me some help how to use the tags to make sort of link tag wich you can use to add your rss-feed etc.
Regards,
Raptor
Great plugin, Ed!
A little bug though... I learned the hard way that if an RSS Feed is super-short, but it contains a gigantic image, the <img> tag is NOT removed and so the huge image posted on someone elses blog overshadows my blog. After a bit of trial and error, I also discovered that links and other tags are not stripped out either of short posts that are supposed to be truncated.
I've found the cause of this anomaly around Line 174 in _magpierss.php
if ( $cut_item_desc )
{ // do this if long descriptions are to be cut down
$strip_item_desc = strip_tags($item_desc);
$strip_item_desc_len = strlen($strip_item_desc);
if ( $strip_item_desc_len >= $cut_item_desc_to ) {
if ( $link_truncated_item )
{ // do this if cut down items get linked to the article
$continued_text = "<a href=\"".$item_url."\" title=\"read more!\"><em> (read more)</em></a>";
}
else
{ // do this if truncated items do not get linked to the article
$continued_text = "<em> (read more)</em>";
}
$item_desc = substr($strip_item_desc, 0, $cut_item_desc_to).$continued_text;
}
}
Basically, HTML Tags are only removed by the declaration:
$strip_item_desc = strip_tags($item_desc);
but this only happens if:
$cut_item_desc is set to "true"
And then the stripped string replacement only occurs by the declaration: $item_desc = substr($strip_item_desc, 0, $cut_item_desc_to).$continued_text;
if the post is longer than value set ($strip_item_desc_len >= $cut_item_desc_to)
This means that if "$cut_item_desc = false;" or if a post is shorter than the value of $cut_item_desc_to, then HTML Tags are NOT stripped from the RSS Feed.
[u]Long story short, here's my fix:[/u]
FIND (in LINE 81):
$fix_bad_tags = true;
ADD after:
$remove_tags = true;
then FIND (around Line 172):
if ( $cut_item_desc )
{ // do this if long descriptions are to be cut down
$strip_item_desc = strip_tags($item_desc);
$strip_item_desc_len = strlen($strip_item_desc);
if ( $strip_item_desc_len >= $cut_item_desc_to ) {
if ( $link_truncated_item )
{ // do this if cut down items get linked to the article
$continued_text = "<a href=\"".$item_url."\" title=\"read more!\"><em> (read more)</em></a>";
}
else
{ // do this if truncated items do not get linked to the article
$continued_text = "<em> (read more)</em>";
}
$item_desc = substr($strip_item_desc, 0, $cut_item_desc_to).$continued_text;
}
}
REPLACE with:
// START TAG Removal added by StayPuft
if ( $remove_tags ) // added by StayPuft
{ // remove HTML tags
$item_desc = strip_tags($item_desc);
}
// END TAG Removal added by StayPuft
if ( $cut_item_desc )
{ // do this if long descriptions are to be cut down
if ( $remove_tags )
{ // tags have already been removed
$strip_item_desc = $item_desc;
}
else
{ // remove HTML tags
$strip_item_desc = strip_tags($item_desc);
}
$strip_item_desc_len = strlen($strip_item_desc);
if ( $strip_item_desc_len >= $cut_item_desc_to )
{
if ( $link_truncated_item )
{ // do this if cut down items get linked to the article
$continued_text = "<a href=\"".$item_url."\" title=\"read more!\"><em> (read more)</em></a>";
}
else
{ // do this if truncated items do not get linked to the article
$continued_text = "<em> (read more)</em>";
}
$item_desc = substr($strip_item_desc, 0, $cut_item_desc_to).$continued_text;
}
else
{
$item_desc = $strip_item_desc;
}
}
My edit fixes it so HTML tags are stripped out of the short posts (as Ed had originally intended) but it also strips out the tags from the long posts if so desired based on the added variable $remove_tags.
If you set $remove_tags to "true", I'd recommend setting $fix_bad_tags to "false" since there's no need to clean the tags if you're straight-up removing them.
Thanks! I think I have this hack on my blog so I'll go back and add your improvements to it (with credits of course). I'll also make your changes part of the initial post here.
Thanks, Ed! You rock! :)