solved RSS Feeds Additional Data

jimmyk
jimmyk
@jimmy
6 years ago
514 posts
Quote: foreach ($xml->channel->item as $item) {
if ($i == $params['limit'] ) {
break;
}
$_x['item'] [$i] ['title'] = (string) $item->title;
$_x['item'] [$i] ['link'] = (string) $item->link;
$_x['item'] [$i] ['pubDate'] = strtotime((string) $item->pubDate);
$_x['item'] [$i] ['description'] = (string) $item->description;
$_x['item'] [$i] ['category'] = (string) $item->category;
$i++;
}

How do you add an additional level so that the channel > image > url can be grabbed inside the channel section?

The way the feeder is now, it's only one level deep (inside the channel only).
updated by @jimmy: 10/24/18 09:27:27AM
michael
@michael
6 years ago
7,744 posts
Were are you seeing that code? Are you changing the way the modules code is directly in the module? ( not via listener )

--edit--
When you put {debug} in your template, you're expecting to see a variable that's not there? where is the feed url?
updated by @michael: 07/23/18 03:12:50PM
jimmyk
jimmyk
@jimmy
6 years ago
514 posts
Yea, this is in the includes.php file I believe, not open in front of me. I was trying to do something fast to see if it could be done. I needed the image for a template and then ran into the RSS - array thingy.

Is there a better way to do this with a listener?
michael
@michael
6 years ago
7,744 posts
When you put {debug} in your template, you're expecting to see a variable that's not there? where is the feed url?
jimmyk
jimmyk
@jimmy
6 years ago
514 posts
No. I just need to get into one layer deeper in the RSS feed.

How it is now, which works great and I can add other options like category.

Quote:
channel -> title
channel -> description
channel -> pubdate

What I need is the ability to go one level deeper because that is where the image is.

Quote:
channel -> image -> url

In the code snippet in the OP I couldn't figure out a way to go one level deeper inside a foreach with
Quote: $_x['item'] [$i] ['image'] ['url']
returns an ARRAY.

Example Feed:
https://www.technologyreview.com/topnews.rss

updated by @jimmy: 07/23/18 03:26:39PM
michael
@michael
6 years ago
7,744 posts
update to 1.2.5
https://www.jamroom.net/the-jamroom-network/networkmarket/72/rss-feed-and-reader

and the image variables will be available in the {debug} output, arrange as necessary.
jimmyk
jimmyk
@jimmy
6 years ago
514 posts
Nice. Having that image makes the feed reader really powerful for adding content to a site. ;)
michael
@michael
6 years ago
7,744 posts
You'll need to explain the why of that to me ;)

How are you using it? is it something that should be shown by default do you think?
jimmyk
jimmyk
@jimmy
6 years ago
514 posts
Well with the image you turn a boring text feed into a faux news article(s).

When I'm done with the project I'll send you the link.

Thanks again for adding that to the module.
updated by @jimmy: 07/23/18 04:11:33PM
michael
@michael
6 years ago
7,744 posts
cool, because that info is for the CHANNEL, not the items in the channel. Which I expect you could have just setup you're own anyhow.

I'll wait and see. Thanks Jimmy :)
jimmyk
jimmyk
@jimmy
6 years ago
514 posts
You're correct, in the particular RSS feed I gave you the image is part of the channel. That was my mistake, I should've given you an example where the image was part of the item.

You can see here the full spec. It would be great to have all the options.

http://www.rssboard.org/rss-draft-1

I could add more options if I knew how to get into the second level via the code (described above) or another option.

I haven't taken a look at your modification yet, but if you didn't modify it for the image inside the item, then I still need to figure that out.

Edit: if you guys are doing an RSS reader, might as well add all the options. There aren't that many and it makes the reader more robust.
updated by @jimmy: 07/23/18 04:35:07PM
michael
@michael
6 years ago
7,744 posts
That's just some proposed structure as I read it.

and the link you sent me as a reference fails the validator.
https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fwww.technologyreview.com%2Ftopnews.rss


Would be nice to have a reference feed that passes the validator and contains what you're wanting in it. Makes it easier to test any changes.

--edit--
and even that proposed doc only has a CHANNEL image, there is no images on the items.
proposed.jpg
proposed.jpg  •  79KB


updated by @michael: 07/23/18 04:51:52PM
jimmyk
jimmyk
@jimmy
6 years ago
514 posts
You're right. I missed that. There is no image in the item. I really need to stop doing 3 things at once.

I could have swore that I've seen image per item. But as you pointed out, and I missed, there is no image in item.

Arrr.

Thanks for adding the image in the channel. That will work well for me as the feed image.
updated by @jimmy: 07/23/18 05:06:21PM
jimmyk
jimmyk
@jimmy
6 years ago
514 posts
Looks like the 2.0 spec for media items in the item is media.

http://www.rssboard.org/media-rss#optional-elements

RSS Feed
http://blogs.barrons.com/techtraderdaily/feed/
updated by @jimmy: 07/23/18 05:12:40PM
michael
@michael
6 years ago
7,744 posts
reload from the marketplace
ACP -> MODULES -> CORE -> MARKETPLACE -> TOOLS -> RELOAD MODULES OR SKINS -> RSS FEED READER -> RELOAD

and you'll find the 'media' array attached to the item.
jimmyk
jimmyk
@jimmy
6 years ago
514 posts
michael:
reload from the marketplace
ACP -> MODULES -> CORE -> MARKETPLACE -> TOOLS -> RELOAD MODULES OR SKINS -> RSS FEED READER -> RELOAD

and you'll find the 'media' array attached to the item.

You da man! Thanks I appreciate it. Also, thanks for dealing with my crazy mind seeing things! LOL! Could have swore that image was in item.
jimmyk
jimmyk
@jimmy
6 years ago
514 posts
One thing I was noticing in some RSS descriptions, the feed contained html and images. Those images then appear in the feed widget.

I wonder if it would be a good idea to have a switch which allowed someone to filter the html and images out of the description and only return text. Most of the examples I've seen of images in descriptions were all wrapped in html tags.

Just a thought.
updated by @jimmy: 07/24/18 02:17:56AM
michael
@michael
6 years ago
7,744 posts
for those that want to adjust stuff changing:
{$item.descripton}
to
{$item.descripton|jrCore_strip_html}
would sort that for them in the rss_list.tpl file.

The platform is supposed to be customizable, not sure we have to turn every possible customization available into a menu option.
jimmyk
jimmyk
@jimmy
6 years ago
514 posts
Thanks.
updated by @jimmy: 07/25/18 05:11:07AM
michael
@michael
6 years ago
7,744 posts
didnt mean to cause stress. sorry if it came across wrong.
jimmyk
jimmyk
@jimmy
6 years ago
514 posts
michael:
didnt mean to cause stress. sorry if it came across wrong.

No worries. I was having a bad morning and that came across in my reply.

I do appreciate all your help!

Tags