Click to See Complete Forum and Search --> : limiting number of categories displayed in magpie


kudzugazette
01-22-2009, 10:45 PM
I'm trying to display a feed using magpie that has multiple categories. However, I only want it to display the first category.

Right now it's just:
$item['category'];

RSS example:
<category>SoapBox</category>
<category>First 100</category>
<category>obama</category>

I only want the first category, in this case SoapBox, to display.

Any ideas?

jkmyoung
01-23-2009, 11:47 AM
$item['category'][0];
?

kudzugazette
01-23-2009, 12:51 PM
nein, that reduces it to just one character.

jkmyoung
01-25-2009, 10:27 PM
Please show the code you're using to retrieve and display it.

kudzugazette
01-26-2009, 02:40 PM
The code I'm using to retrieve and display it is very simple:

$category = $item['category'];
$title_str = substr(addslashes(strip_returns(strip_tags((htmlspecialchars($item['summary']))))), 0, 255) . '...';
$str.= "document.write('<b>&bull;&nbsp; $category:</b> (etc etc)

At any rate, I'm just using one category now, so it's not the end of the world.