Warning: include_once(/www/templates/gt/parts/blogs/carptips/first.php) [function.include-once]: failed to open stream: No such file or directory in /www/gt/docs/carp/tips/index.php on line 19

Warning: include_once() [function.include]: Failed opening '/www/templates/gt/parts/blogs/carptips/first.php' for inclusion (include_path='.:/usr/local/lib/php') in /www/gt/docs/carp/tips/index.php on line 19

Friday, February 17, 2006

CaRP gets podcast support, themes 

I released a new version of CaRP yesterday with a few added features. First, the mundane: CaRP error messages are now linked by default to a page in the documentation that explains how to fix them. You can turn the links off or turn the error messages off altogether using the carperrors setting. Now on to the fun stuff.

First, I've added podcast support. At first, I planned to just write some sample code showing how to do it with the old version, but I quickly discovered that it was impossible! Why? Because enclosures (which carry the link to a podcast) were hard coded to only be used to display images. So I took out the hard coding, and added explicit podcast support.

Second is themes. A theme is a file with a bunch of configuration code that you can install in a new "themes" directory and load for quick configuration. At present, I've got just one theme which sets up CaRP to display the feed as an unordered list with the description truncated to 250 characters. Come up with a nice configuration, submit your own theme, and become famous and beloved among CaRP users!
// posted by Antone Roundy @ 1:19 PM
(1) comments

Thursday, February 09, 2006

How to display Japanese RSS feeds using CaRP 

I just released an update to CaRP that makes the truncation code that is used to limit the length of titles and description multi-byte aware. In the past, CaRP counted each byte as a character even for characters composed of multiple bytes, and ran the risk of chopping a chacter in half if a multibyte character spanned the truncation boundary. The new version won't do that. The bad news is that that's not the only problem CaRP had with multibyte feeds. The good news is that I've got a solution for the other problem.

The other problem was that the only multibyte encoding that CaRP can handle is UTF-8 (since that's the only one that PHP's XML parser can handle). So to display, for example, Japanese feeds encoded in Shift JIS or EUC, you need to first transcode them to UTF-8. And if your webpage isn't encoded in UTF-8, you'll also need to transcode the output to the character set that you're using. If you've purchased CaRP Koi or CaRP Evolution, you'll find a transcoder script that will handle the first half of that, but the second half can be handled in your webpage more efficiently.

Here's some example code--first, for the case where your webpage is in UTF-8:

require_once '/YOUR/PATH/TO/carp/carp.php';
CarpCacheShow('http://YOUR-SITE.COM/transcode.php?url='. urlencode('http://EXAMPLE.COM/FEED.RSS'));

Notice how CaRP gets the data from transcode.php (in UTF-8, which is transcode.php's default output encoding) by passing the URL of the feed to transcode.php.

Now, how about if your webpage is in Shift JIS:

require_once '/YOUR/PATH/TO/carp/carp.php';
CarpCacheShow('http://YOUR-SITE.COM/transcode.php?url='. urlencode('http://EXAMPLE.COM/FEED.RSS'));
echo iconv('UTF-8','Shift_JIS//TRANSLIT',$carpoutput);

In this case, you use the outputformat setting to tell CaRP not to output anything, but instead store it in the variable $carpoutput. Then, you use iconv to convert $carpoutput from UTF-8 to Shift JIS, and echo to output the results.

Note that transcode.php and the code shown above require iconv support, so if your server doesn't have it, you'll have to find your own way to handle the transcoding.

So there you have it--CaRP is now suitable for working with feeds in any language!
// posted by Antone Roundy @ 5:22 PM
(0) comments

Friday, February 03, 2006

Incentives for CaRP users to help each other? 

I've just posted in the CaRP user forum regarding what incentives I can provide for CaRP users to help each other with tech support questions and such. It's not that I begrudge doing tech support--just that it's often difficult to impossible to manage all the different tasks that I have to juggle, and if possible, I'd like to free up more time for adding features and working on the next generation versions of CaRP and Grouper and some add-on products that many of you have expressed interest in.

Please share your thoughts on the matter in the forum.
// posted by Antone Roundy @ 4:12 PM
(0) comments

Wednesday, January 11, 2006

Displaying RSS feeds in Mambo/Joomla content 

If you'd like to display an RSS feed on your Mambo or Joomla CMS-powered site, the easiest way is to install the "Add PHP" mambot. Then put your CaRP code into a PHP file, upload it to your server, and pull it into your content like this: {rdaddphp file=rssfeed.php} (type the curly braces and everything between them into the content editor, with the filename changed as needed, and a relative path to the file added if needed).
// posted by Antone Roundy @ 10:12 AM
(11) comments

Thursday, November 03, 2005

Displaying RSS feeds in ASP pages using CaRP 

CaRP is a PHP script, so naturally, using it in PHP pages is easier than in non-PHP pages. You may already know that you can use CaRP's JavaScript output option to display feeds in non-PHP pages. You may also know that if you do that, search engines won't be able to see the feed's content. You may know that with SSI, you can often #include a PHP page into another page and have the PHP code executed. But sometimes SSI #includes don't trigger the PHP code in the page that's being imported. Here's a little code snippet that I used today to import the output from a PHP script (running CaRP) into an ASP page when using an SSI #include failed to execute the PHP:

Dim objHttp
set objHttp = Server.CreateObject("Microsoft.XMLHTTP")
objHttp.open "POST", "http://example.com/feed.php", false
If objHttp.status = 200 Then
End If
set objHttp = nothing
// posted by Antone Roundy @ 3:52 PM
(18) comments

Saturday, October 29, 2005

CaRP's Amazon.com associates example code has been updated 

The Amazon.com associates example code has been udpated to work with Amazon's latest changes to their web services API. A few of the changes include:

* Uses Access Key IDs instead of Developer Tokens or Subscription IDs (neither of which is being issued to new associates anymore since they're not used by the latest API).

* Has built-in support for searching non-US Amazon sites.

* The number of characters displayed from each review is configurable.

* The example page lists available search indexes (Books, DVD, Electronics, etc.)

* Uses the same XSL template for both the single review and multiple reviews cases.

Here's hoping Amazon continues to support this version for a long time--digging through their documentation to figure out some of the changes, and updating the XSL template are not my idea of a good time! Enjoy the fruits of my labors!
// posted by Antone Roundy @ 12:12 PM
(5) comments

Friday, October 07, 2005

Multi-affiliates search page example using CaRP and Grouper 

I've posted an Affiliates RSS Example showing how CaRP and Grouper can be used to create a search page for multiple affiliates programs. A few noteworthy notes:

1) The affiliate search results are displayed on your website so that if your visitor doesn't find anything interesting, they're still on your site.

2) Multiple merchant sites can be searched from the same page, increasing the probability of your visitors finding something they're interested in. At the moment, the example code only searches Amazon and All Posters. More merchants will be added later.

3) Google AdSense ads appear on the page--if you don't reach your visitors in one way, you might reach them in another.

4) The example requires Grouper Evolution. As it appears on our site, it also requires CaRP Evolution, but could be easily adapted to the other versions of CaRP. With CaRP Koi, the AdSense add could not appear inside the search results (because without the FlexFormat plugin, more ads than Google allows would be displayed). With CaRP GPL, the images could not be displayed.

5) Default search terms are automatically entered when you first arrive at the page--if you have an idea of what your visitors might be looking for, don't waste an opportunity by showing them a blank page when they arrive. Also, having the page filled with results by default means that there's content for the search engines to see.

6) Finally, the "method" for the search form is "get". This is important if you have AdSense ads on the page, because without it, Google couldn't deliver relevant ads based on the visitor's search terms.
// posted by Antone Roundy @ 10:50 AM
(0) comments

This page is powered by Blogger. Isn't yours?

Warning: include_once(/www/templates/gt/parts/blogs/carptips/second.php) [function.include-once]: failed to open stream: No such file or directory in /www/gt/docs/carp/tips/index.php on line 161

Warning: include_once() [function.include]: Failed opening '/www/templates/gt/parts/blogs/carptips/second.php' for inclusion (include_path='.:/usr/local/lib/php') in /www/gt/docs/carp/tips/index.php on line 161

Warning: include_once(/www/templates/gt/parts/blogs/carptips/third.php) [function.include-once]: failed to open stream: No such file or directory in /www/gt/docs/carp/tips/index.php on line 168

Warning: include_once() [function.include]: Failed opening '/www/templates/gt/parts/blogs/carptips/third.php' for inclusion (include_path='.:/usr/local/lib/php') in /www/gt/docs/carp/tips/index.php on line 168