collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Recent Posts

Can't get RSG "Show My Galleries" to work by Dampfnudel
[February 25, 2019, 11:01:55 AM]


Change the order of uploaded images in the gallery by whazzup
[February 19, 2019, 10:37:29 PM]


Upload timeout for large galleries (500 images each) by whazzup
[February 11, 2019, 10:07:25 PM]


Greetings from Ronald Smit by whazzup
[January 06, 2019, 03:39:22 PM]


Pluign and module by whazzup
[June 08, 2018, 11:57:13 PM]


Version 4.4.1 released by whazzup
[May 31, 2018, 04:31:16 PM]


search.html.php refer to rsgsearch.css with a wrong path by whazzup
[January 13, 2018, 08:12:04 PM]


Slow Gallery with many Photos by whazzup
[September 22, 2017, 09:22:33 AM]

Creating an RSS feed

  • 10 replies
  • 10081 views
*

Offline Mike

  • *
  • 45
Creating an RSS feed
« on: June 16, 2007, 04:40:15 PM »
I am trying to create an RSS feed that displays the latest image from a certain gallery. Having never never written an xml template I'm finding it a challenge. Following the advice of the xml template guide I have looked at generic.php and todd_dominey.php, I was thinking that since an rss feed needs a different layout than a flash gallery template it would be better to not try to extend the generic.php ?

One problem I am having is how to restrict the template to one gallery, I only want the feed to call images from a specific gallery.

An rss2 feed needs a layout similar to this (I have shown what a "latest image" feed's structure would look like:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://mysite.com/com_rsgallery2/xml_templates/rss.css" ?>
<rss version="2.0">
<channel>
<title>Latest from   X-GALLERY</title>
<link>Link to main site</link>
<description>This is the latest from    GALLERY</description>
<lastBuildDate>DATE OF LATEST IMAGE in this format Mon, 12 Sep 2005 18:37:00 GMT</lastBuildDate>
<language>en-us</language>
<item>
<title>Title of LATEST IMAGE</title>
<link>Link to latest image page</link>
<guid>Link to latest image page</guid>
<pubDate>DATE OF LATEST IMAGE in this formatMon, 12 Sep 2005 18:37:00 GMT</pubDate>
<description>[CDATA[ <img src"link to image" /><br />Description of LATEST IMAGE. ]]</description>
</item>
</channel>

I have attached the file which I am working on at the moment. As it is I have the basic layout and I am now trying to find the variables to exchange for the labels. To start with I am attempting to use the code for the function showLatest from display.class.php but I have no idea if this would work and there are a lot more variables that I need to work out.

link to home page (can I use $GLOBALS[mosConfig_live_site] ?)
name of x-gallery
title of latest image
link to latest image
direct link to latest image to display in feed (i.e <img src="">)
date the image was entered into the db (used for both lastBuildDate and pubDate
image description

For now I am going to try and take the variables from display.class.php and see how that works, any help to speed this along would be much appreciated :)

Also, does anyone know if I can put php snippets in a CDATA section?
Many thanks,
Mike

[attachment no longer available]

*

Offline Jonah

  • ****
  • 1.412
Re: Creating an RSS feed
« Reply #1 on: June 17, 2007, 12:06:06 AM »
Hi Mike,

You pretty much have to extend generic.php and it will be easiest to do so. Here's what you need to do:

In the URL to xml file add &gid=43.  This will autoload the gallery with ID 43.

Here's some pseudo code for how your file should look like:

Code: [Select]
class rsgXmlGalleryTemplate_rss_latest extends rsgXmlGalleryTemplate_generic{

    function getName(){
        return 'RSS Latest';
    }
    function prepare(){
    $images = $this->gallery->items();
   
    $images now contains an array of database row arrays representing the images in the chosen gallery.  sort $images by date
   
    assign xml to $this->output.  $this->output is later echoed 
    }
}

you might want to do a print_r() on $images to see for yourself what it contains.  you can then use standard php sorting functions to sort $images and obtain the latest image.  by default $images is ordered by ordering.

Due to time constraints, I have taken a step back from RSGallery2.  In the event of an emergency, you will need to PM me.

*

Offline Jonah

  • ****
  • 1.412
Re: Creating an RSS feed
« Reply #2 on: June 17, 2007, 08:15:24 AM »
Sometime early in the 1.14 series the filter_order will be implemented and save you from having to manually sort the images.  So that functionality would be handy here but it's not finished yet.
Due to time constraints, I have taken a step back from RSGallery2.  In the event of an emergency, you will need to PM me.

*

Offline Mike

  • *
  • 45
Re: Creating an RSS feed
« Reply #3 on: July 03, 2007, 05:08:04 AM »
Is there a way of adding an RSS feed created for RSGallery to the main rss feed of a joomla site, it seems strange to have two rss feed, one for content and one for images.

*

Offline Jonah

  • ****
  • 1.412
Re: Creating an RSS feed
« Reply #4 on: July 03, 2007, 08:48:29 PM »
That's an interesting idea.  The only way to do that is create a custom RSS feed that did both at the same time.  The default RSS feed only publishes news items on the frontpage.
Due to time constraints, I have taken a step back from RSGallery2.  In the event of an emergency, you will need to PM me.

*

Offline Mike

  • *
  • 45
Re: Creating an RSS feed
« Reply #5 on: July 05, 2007, 04:01:54 AM »
Quote
The default RSS feed only publishes news items on the frontpage.
Yeah, I guess I would have to modify it to include the latest images. Not exactly sure how though. But an interesting idea. Just seems pointless having two feeds for one site, should be the option to have one feed for content one for gallery or one that does both. Oh well.

*

Offline Jonah

  • ****
  • 1.412
Re: Creating an RSS feed
« Reply #6 on: July 05, 2007, 06:12:02 PM »
I would be nice for Joomla to have an aggregator that would combine newsfeeds from different components.  Plugins could be installed to add content to it.

By the way, a podcasting xml template has been added to the SVN.  I believe this is very similar to what you were looking for in a RSS feed.
Due to time constraints, I have taken a step back from RSGallery2.  In the event of an emergency, you will need to PM me.

*

Offline Parth

  • ****
  • 41
    • Tekdi Web Services
Re: Creating an RSS feed
« Reply #7 on: July 22, 2008, 07:18:28 AM »
Hi There Everyone,

I'd like to know if there has been any progress with creating an XML template..or rather is there any template that can be readily used. If not i am going to go ahead & build one. I just need to make sure i am not reinventing the wheel.

I am looking at making three variable - Latest Photos, Top Rated Photos & Top Viewed Photos.

Also Jonah, the xml aggregator idea is something we have been looking into developing for some time now.. If we get to doing it, i'll let everyone know..

I need to get the template in place fast so will have to start work ASAP. If anyone has any idea of the progress on this front let me know asap.

Regards

Parth
Tekdi Web Services
Taking Joomla to the next level!
http://www.tekdi.net

*

Offline Parth

  • ****
  • 41
    • Tekdi Web Services
Re: Creating an RSS feed
« Reply #8 on: July 22, 2008, 01:59:39 PM »
Ok Got that to work..

Now i have a template that can output the XML of the gid that i pass to it..

Now i need to create Feeds of images in all galleries ordered by hits,rating & latest..

Any tips are welcome... 
Tekdi Web Services
Taking Joomla to the next level!
http://www.tekdi.net

Re: Creating an RSS feed
« Reply #9 on: August 19, 2008, 04:19:37 AM »
Ok Got that to work..

Now i have a template that can output the XML of the gid that i pass to it..

Now i need to create Feeds of images in all galleries ordered by hits,rating & latest..

Any tips are welcome... 

I've been messing around with XML & RSS in rsg a little, maybe i can help. Can you post your code here or somewhere in the svn?

Chef Groovy
RSGallery2: Legacy - Dev
Test Site: dev.fantasyartwork.net

Re: Creating an RSS feed
« Reply #10 on: September 15, 2008, 03:24:22 AM »
did someone finished an RSS feed extensions for rs gallery?
that would be wonderful
ka
www.ninc.at