PDA

View Full Version : Using Carp RSS for News Feed Content


Pages : [1] 2

Greg
06-06-2005, 12:06 PM
This is not a tutorial on installing carp rss, the intent here is to show you how to use carp rss after it's setup. However, feel free to ask questions on setup and such. But we'll assume you have carp rss installed and working and want to tweak/configure it.

Let's walk through the basic settings we use. There are many, others may use more or less.

We have to deal with formatting descriptions and items. This is our example.

Channel Formatting Options (http://www.geckotribe.com/rss/carp/docs/conf/display/channel/)
This is usually required to display. You show the provider as recognition for using the feed. How you have to display it may vary, some sites may not require it, most do. That's on you to be a fair player. So let's display a few of the available pieces of information.

You use the CarpConf() function to set the configuration. First argument is the setting, next are the settings.

CarpConf('cborder','image,title,link,desc');

This will display four parts of the channel info. Description, link to the feed, the feed image if available and the Title of the feed. This will be formatted pretty well on display. Image first, title, link, then description.

Let's set the length of the description for the channel with CarpConf() now.

CarpConf('maxcdesc',300);

That tells carp to display up to 300 characters of any description provided.

Now let's do the default image format from a carp example.

We will use the CarpConf() function to set what html code gets put before and after the image as well as what size to tell the html code to define in the img tag.

CarpConf('bcimage','<div style="float:left;margin-right:5px;">');
CarpConf('acimage','</div>');
CarpConf('maxcimagew',200);
CarpConf('maxcimageh',100);

The above puts the image in a div, left justified with a five pixel border on the right side. It tells carp to make the img tag size parameters 200x100 pixels.

Now we just need a space after the Channel info and we can move on to the news items. To put html breaks after the channel info for spacing we use the CarpConf() function again...

CarpConf('acb','<br /><br />');

That will tell carp to put two html breaks after the channel info for spacing.

Let's do the items now. It's the same proceedure with different CarpConf() settings.

Item Formatting Options (http://www.geckotribe.com/rss/carp/docs/conf/display/item/)
First we set what we will display with CarpConf()...

CarpConf('iorder','link,date,author,desc');

Again we have four pieces of data. Link, Date, author and description. Most feeds require you to display that much for them to make sense. This is up to you however.

Now lets do some display settings.

CarpConf('maxidesc',600);
CarpConf('maxititle',400);
CarpConf('maxitems',10);

The above set the Length of the description, the news feed article title and the number of items to display if that many are available.

The description is one you can play with. The more you show, the better the content.

The title we set long always. We use alot of yahoo! news feeds and the TOS says to display it all and we try to comply with that setting high to display all characters in the title.

Maxitems will tell carp how many of the available article items to display. I'll go out on a limb and say alot of feeds only supply 10 items at a time.

Item links can be controlled as to how they open. This setting will make the item links open in a new window.

CarpConf('linktarget',1);

This is usually a benefit as when they close the opened window, folks are back at your site.

Caching your Carp RSS News Feed
Caching your feed will make it so that your site only requests a news feed at a certain interval. Every specified time period, carp will make a call for the news and store a copy locally. This is a performance benefit for both us and the feed provider. You should always use this and the general rule is fetch at least 60 minutes apart.

CarpConf('cacheinterval',60);

That will tell carp to update the cache every 60 minutes and display the local copy any other time.

That's the basics. If you have any questions, post and we'll build on what we have.

Attached is a template in php to get you started with one single predefined feed from yahoo! news.

Here is the Carp RSS News Feed Template (http://www.lakecs.com/carptemplate.php) demo.

Regards.

Bazkaz
06-06-2005, 12:44 PM
Thanks for taking the time Noppid. I'll have to play with it when I get home tonight.

Greg
06-06-2005, 01:00 PM
Thanks for taking the time Noppid. I'll have to play with it when I get home tonight.

I'll put together a working template folks can use to get started with and post it I guess.

That should be a big help.

Greg
06-10-2005, 05:25 PM
Ok, for those of you wanting to use this in FREEBS, I have created a variable conflict. One of the possible pitfalls of reusing code. :D

Anyhow, I've updated the Carp RSS Template to remove the conflict. If you need to do this, you can do a global search and replace of $keyword to perhaps $rss_keyword as I have.

seeknulfind
06-16-2005, 08:52 AM
Hi Noppid,

Thanks for the great info and template!

One question for now...what does '&amp;ei=UTF-8&amp;fl=0&amp;x=wrt' mean? is this specific (ok one+ questions!) to the yahaoo feed or should it be used for other feeds as well?

Andy

Greg
06-16-2005, 10:48 AM
That is specific to yahoo.

Evenrude
06-25-2005, 07:52 PM
great info!

I'll be sure to come back and check out the rest of your site.

Thanks!

Michael
12-14-2005, 09:44 AM
I found this very useful i must admit.
Here (http://www.staff-lounge.com/vbulletin/) is what i gathered together as a result.

Greg
12-14-2005, 10:37 AM
I found this very useful i must admit.
Here (http://www.staff-lounge.com/vbulletin/) is what i gathered together as a result.


Shhhh, don't tell everyone. ;)

dholt
03-16-2007, 06:45 AM
Hello, I'm sorry to be such a noob with this, and thanks for the template as I was not sure what to do or use.

I am using vbadvanced CMPS v2.2.1 and vBulletin® Version 3.6.5 on my site.

For one I am not understanding this template and how to add it. what I have done so far is:

1.installed carp and created a db for in in mysql, after I instaled it created a code for me that looks something like this but with the mysql info in it also.

<?php
require_once '/YOUR/PATH/TO/carp/carp.php';
// Add any desired configuration settings before CarpCacheShow
// using "CarpConf" and other functions

CarpCacheShow('http://www.geckotribe.com/press/rss/pr.rss');
?>


2Created a new file with the code posted above and saved it to /forum/modules directory on server. Then added a new PHP file module, select that file as the file to include, and turn the "Clean File Output" setting on.

3Now I want to create the page, so I created a new "PHP File" page with the CMPS and entered the path to the template file you created as the for the "Path to File" setting. home/html/site/carp/template/Carp RSS News Feed Template.

This is what it is looking like and not like what you are talking about, I'm sure I'm doing a lot of things wrong here so if you can explain to me.

Thanks in advanced
Link to the page in Question (http://www.delawarebulletin.com/index.php?page=yahoo)

dholt
03-16-2007, 12:39 PM
ok I got it to work yea woot woot but for some reason the images do not display as I tried to add


// setup channel

// set what details to display
CarpConf('cborder','link,desc');
// set description length
CarpConf('maxcdesc',300);
// put breaks after the channel info
CarpConf('acb','<br /><br />');

CarpConf('bcimage','<div style="float:left;margin-right:5px;">');

CarpConf('acimage','</div>');

CarpConf('maxcimagew',200);

CarpConf('maxcimageh',100);
// setup items


As it said in your instructions but I get nothing.

Can someone please help with this

Greg
03-16-2007, 07:39 PM
I think you need... CarpConf('cborder','link,desc,image');

The first issue is probably cause carp echos it's output. You need to buffer it to a variable with on_start (http://us3.php.net/manual/en/function.ob-start.php).

dholt
03-16-2007, 08:35 PM
No I was just pulling a feed with no image, I must have been staring at the screen for too long today. :eek:

Thanks for the reply great site by the way.

Greg
03-16-2007, 08:40 PM
Damn, I hate when that happens. I was actually jealous of the example page when I saw images. I never get any.

Thanks for coming by.

kdemonte
07-06-2007, 02:36 PM
I have the free version and I want to change the colors and background on the output but there isn't a css file or something that says blatantly "style here" is there a way to customize colors output on this somewhere and I'm missing it?

Greg
07-06-2007, 03:38 PM
Like everything in CARP, it's done in a setter call to the class for the need.

Anywho, you can set before and after code for channels and items. Look at at the examples. http://carp.docs.geckotribe.com/conf/display/

kdemonte
04-27-2008, 08:41 PM
Ok, am I the only one that ever has Carp questions LOL and apparenlty almost a yearly question looking at my last post. Anyway, as you can tell, its been awhile since I installed this so I'm not totally sure if or how this is possible. I just installed carp on a client website which can be seen thedotag.com/childhood_obesity_news.php it works fin but how or is it possible to get rid of the top part that says "google news:childhood obesity" I assume google purposely did this, I hate the look, if atleast it was after the feeds it wouldn't be so bad IMHO.

How you doing Noppid, I haven't seen you around or talking to you.. I mean nagged you with questions in awhile :-)

Greg
04-29-2008, 12:58 PM
Doing good, thanks. Can you link me so I can see what ya got so far? I'm sure it's just a setting.

kdemonte
05-01-2008, 08:53 AM
Sure I got it install at http://thedotag.com/childhood_obesity_news.php it may just be the google feed automatically forces it there?? Also the feed isn't updating it appears the same a the day I installed it???

Greg
05-01-2008, 01:39 PM
That's got a name, but it escapes me at the moment. It's customary to leave it there and give credit to the feed. But I think ya can move it to the bottom.