Support » Plugins » CG-FeedReader Problems

  • I’m trying to use the CG-feedreader, and I’ve installed the plugin but when it comes to the code I’m supposed to put on the site, I’m having problems. Can someone explain a little more clearly exactly what code goes on the page and what parameters do I need to change? When I put the code on the sidebar, the code itself is showing up on the page. Here’s a copy of the readme instructions:To better integrate into the default WP styling scheme, for a sidebar feed,<BR>
    I’ve included some ‘simple block’ functions. Try code like the following<BR>
    in the menu/sidebar section of your template:<BR>

      $feedUrl = ""; // enter your feed's url here<BR>
      $feedOut = getSomeFeed($feedUrl, 4, false, "feed-cache-name", '', 36); // enter a cache name<BR>
      if (!empty($feedOut))<BR>
        start_block("Feedread News", "feedread", "li");<BR>
         echo $feedOut;<BR>

     <hr />
    <h2>Function Parameters</h2>
    Params to getSomeFeed function, in order:<BR>

    function getSomeFeed($InUrl, $numberOfItems, $showDetails, $cacheName, $filterCat='',<BR>
    $tLimit = -1, $dLimit = -1, $noHTML = 1)<BR>

    The fully specified url of the news feed.<BR>
    How many items to display from the feed. Taken in order.<BR>
    Show just the title, or show the details/body as well?<BR>
    What to name the cache file on disk (obv give it something unique from other feeds!)<BR>
    NOTE: caching is important, so that you don’t repeatedly hit feeds.<BR>
    The global $CACHE_TIME controls the age of the cachefile before recaching. If not set<BR>
    (global unset), defaults to 24h. NOTE: The SAME global is used in CG-Amazon at the moment.<BR>
    Can leave as ” generally. Allows you to filter items by matching a string in the feed urls<BR>
    or categories. For stripping down big feeds that don’t have sub-categoried feeds.<BR>
    Character limit on titles. (truncates) -1 to leave alone.<BR>
    Character limit on descriptions. (truncates) -1 to leave alone.<BR>
    strips HTML tags from descriptions for safety. set to false to leave alone.<BR>
    <BR> <BR>
     <hr />
    ©Copyright 2003-2005, David Chait. All rights reserved.<BR> 

    Some of this is the actual code and some is an explanation of the code, but even when I copy just the stuff between it still shows the code on the page. So obviously I’m not doing something right. Can someone help me with this?



Viewing 4 replies - 1 through 4 (of 4 total)
  • It should work just fine if you copy/paste the sample code in your file. A link to the error might be helpful. In my sidebar I might have something like:

    <li id="feedread">Feedread News
    $feedUrl = “”;
    $feedOut = getSomeFeed($feedUrl, 4, false, “CNN Top Stories”, ”, ”, ”, true, false);
    if ($feedOut)
    echo $feedOut;

    or in a page:

    <h2>CNN Top Stories</h2>
    $feedUrl = “”;
    $feedOut = getSomeFeed($feedUrl, 4, true, “CNN Top Stories”, ”, ”, ‘240’, true, true, true);
    if ($feedOut)
    echo $feedOut;

    First, if you are seeing the code, it either isn’t in a .PHP file, or isn’t wrapped in a <?php ... ?> block of code.

    I haven’t tested this, but a one-liner example would be something like the following:
    <?php echo getSomeFeed("", 4, false, "", '', 36); ?>

    Post if you need more help… should be very easy!


    Ok, I got the feedread working now, Thanks! But how do I implement some fo the parameter functions you mention? I’d like to display a little more in the description then just 6-8 words, and I tried to change the number of feeds, which I believe is what the ‘4’ is, to 8 but it didn’t seem to have any effect. Thanks

    the ’36’ controls the ‘title’ character length. if you want it left unrestricted, you can leave out those last two parameters completely (or use -1).

    as for the “number of feeds”, if you mean the “number of items to display from the feed”, then yes, that’s what the 4 is.

    I should note, as people get confused: CG-FeedRead uses a caching system, where it saves the output from the feed for a certain length of time. Right now, the caching system doesn’t “know” when you change the call parameters, it only knows when it last grabbed an update from that feed. So, if you change parameters, the fastest way to get a result if you are just testing is to delete the cache files. Alternately, for SHORT TESTING PERIODS, you can define the following before your call to getSomeFeed:
    $XML_CACHE_TIME = 60*60*3; // 60s x 60m x 3 hours

    The default changes every now and then — at one point it was 24 hours, then it was 7, … You can set it to whatever update frequency you want. So, again, FOR TESTING ONLY, you could set it to say 10 — for updates after 10s since the last grab.. I caution this over and over as if you ping some sites EVERY 10s for more than a few minutes of testing, you may find yourself shut off or blacklisted. But during testing of parameters, it is invaluable.


Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘CG-FeedReader Problems’ is closed to new replies.