The MU forums have moved to WordPress.org

Fetch Rss - problem with sub-Directory (13 posts)

  1. Radecki
    Member
    Posted 16 years ago #

    First off i am not doing a sitewide rss feed pull for my home page. I have done this by modifying andrea_r recent posts code http://blogs.itworldcanada.com/code/ah-recent-posts-mu.txt

    Now for the problem. I am creating a new "section" in my MU site that will have 5-6 blogs that all have custom templates that interlink with each other.

    The "Home page" for this section is required to pull in the latest posts from the other 5 blogs and display them and only them on the page. For other blogs I've used fetch rss to display rss feeds from a related external blog or site.

    <h4>PcWorld Canada RSS </h4>
    <?php // Get RSS Feed(s)
    include_once(ABSPATH . WPINC . '/rss.php');
    $rss = fetch_rss('http://blogs.pcworld.ca/feed/');
    $maxitems = 5;
    $items = array_slice($rss->items, 0, $maxitems);
    ?>

    Then a loop to write the code to the page... which is working fine.

    This works flawlessly.... but only sites that are not in my wpmu install work. If i replace the url with anything that is also on the wpmu install simply returns No items.

    I have tried other wp blogs and even wpmu blogs and they all work fine.

    The problem seems to be related to virtual subdirectories. In that blogs.yourdomain.com/blog/feed/ does not actually have a directory called "blog" on the server only a value sored in a database that is then interpreted as a directory when the request is made..(I think)

    Does anyone know if there is a php value for getting the virtual directories.. or another way to solve this problem ... without using an asp page on a different server thats pulled in by an IFrame....Yuck but it may end up being my only solution.

    Thanks, Radecki

  2. andrea_r
    Moderator
    Posted 16 years ago #

    there's a few givens with that plguin that might be doing it. One, the blogs have to be set to public, and two, it only shows posts made within the past 24 hours. :)

    Also, the virtual-nees of the feed address shouldn't matter really.

  3. Radecki
    Member
    Posted 16 years ago #

    I don't believe that the fetch rss function is a plugin I didn't install it anyways. ( i am using ah_recent_posts for the site home page, not for this problem)

    fetch rss seems to be using files from wp-includes (rss.php) which looks like a magpie rss parser and i believe it all came included with my wpmu install.

  4. lunabyte
    Member
    Posted 16 years ago #

    It did. That's the function that the dashboard uses to grab the WP Dev, and Planet feeds.

    When you change the feed url, you may need to go into the database and remove any rss_a35b2f4.... looking values in the blogs options table. That's where that function stores its cache of the feeds, and as has been documented in the past with this, it doesn't always update/expire it.

  5. Radecki
    Member
    Posted 16 years ago #

    Does that mean it's something i should not be messing around with...lol ( I haven't actually changed the rss.php file yet but was considering it)

    It seems to work very well for reading external rss feeds and displaying them ...

    -Just noticed edited post...
    Would that mean I have to continually delete the rss_2238 from wp-options or would it be just to get it running..?

  6. lunabyte
    Member
    Posted 16 years ago #

    Don't change the file, just remove the cached entries in the db for the individual blog. Then see if it works.

    I quit using that for internal stuff quite a while ago, but at times the cache was an issue when changing feed links.

  7. andrea_r
    Moderator
    Posted 16 years ago #

    See, i thought it was an issue with the ah_recent-posts plugin. :)

  8. lunabyte
    Member
    Posted 16 years ago #

    Reading... It's not just for breakfast anymore!

    :P

  9. Radecki
    Member
    Posted 16 years ago #

    If only it were that easy. Thanks for the suggestion lunabyte but i deleted the values u suggested from my database for the blog i'm using as well as the one i'm trying to pull posts from but i'm still getting the same result.(outside blogs are still working....grrrr)

    You said you stopped using it for internal rss, was this caching problem part of the reason and do u have an alternate suggestion for this.

    I don't mind loading the xml and parsing the nodes with a custom function I'm just not that big into php and I couldn't find anything similar to XMLHTTP used in asp. If i could load the xml file and display specific nodes, i'm confident I could program my way to a solution. I already have thi s fuctioning in asp it's just that I hate iframes and was hoping to learn a lil php as I made my way through it.

  10. lunabyte
    Member
    Posted 16 years ago #

    I quit using it after I internally developed new functionality which made use of this type of function for this purpose no longer necessary.

    Have you looked at the actual feed you're trying to pull? There may be problems with how they're generated or something. Without looking at everything myself, I could sit here guessing for you all night.

  11. Radecki
    Member
    Posted 16 years ago #

    Thanks,

    Thats just the thing the feed looks fine. I've even accessed it through a blog (not wpmu) on the same server using the same fetch rss function and it works fine (as well as in my asp script). I've also used the fetch rss function in wpmu to pull rss outside of my mu so the function should be fine as well.

    The moment I pull an rss feed from one of my mu blogs to another it fails. I always get "no items" which is why I keep coming back to thinking it's related to virtual subdirectories.

  12. jackiedobson
    Member
    Posted 16 years ago #

    Gotta admit that we finally put the feeds that we used on our installs (ie blog #1 and the sitewide feed) into feedburner and then pulled via those URLs. Only way we could get them to work.

  13. Radecki
    Member
    Posted 16 years ago #

    ...It works....

    Not exactly what I was hoping for but better then an asp iFrame I'll keep poking around with this and see if I can come up with something but at least i've found a way to meet my deadline.

    Thanks..

About this Topic