eZ Community » Forums » Developer » Custom URL for export RSS images
expandshrink

Custom URL for export RSS images

Custom URL for export RSS images

Thursday 06 September 2012 7:04:35 pm - 6 replies

Hi. I have a site with EZ 4.4 I want to export in RSS. The thing is that we have a CDN so I would like to have RSS to load CDN URL for images not site URL images. How can I acomplish this? do I have to  edit the RSS templates? or how can I acomplish this?

Friday 07 September 2012 1:31:15 am

HI.  There is no template for the RSS module.  I believe the RSS feed is actually created by the eZRSSExportItem.

If this is true, then I see  two possibilities for you:

1) Use your own RSS export process.  We have done this before  in the following two ways (latest published and some named parameters to control the content (then just a pagelayout and some line views) or more fine-grained by defining the RSS items via ez flow (same deal with simple line views and a pagelayout).  The only gotcha here is dealing with pesky invalid HTML entities on occasion (we fix thi with some preflight filtering of content and a xmltidy.

2) Depending on your naming conventions, I suppose it would be possible to do a solution in your apache config: if the http_referrer is your rss page and the request is to an image, then rewrite (redirect permanently - 301). The only 'gotcha' here is that some minor readers will not work with redirect, but I believe that number is itsy-bitsy.

-David

Tuesday 18 September 2012 6:53:27 pm

Have you looked at the xrowcdn extension?

http://projects.ez.no/xrowcdn/subversion

it manipulates urls using an output filter (ie in index.php, not at template level) and is specifically designed to convert image urls etc to CDN versions of same.

I have a feeling it will do exactly what you need.

Tuesday 18 September 2012 7:20:11 pm

Quote from David Broadfoot :

Have you looked at the xrowcdn extension?

http://projects.ez.no/xrowcdn/subversion

it manipulates urls using an output filter (ie in index.php, not at template level) and is specifically designed to convert image urls etc to CDN versions of same.

I have a feeling it will do exactly what you need.

In fact I have it installed but wont create the URLs with the cloud content for RSS... At least that didnt happened.

Tuesday 18 September 2012 9:50:10 pm

Is xrowcdn working on your main site?

Do the RSS feeds urls have a different structure (absolute, with domain maybe?)

xrowcdn works using configurable regexp matching / replacing, so you should be able to get it functioning the way you desire.

Could you post the RSS url you are working with?

Tuesday 18 September 2012 10:02:13 pm

Xrow works like a charm. RSS always include absolute urls, including the objet one (in this case an image).

Is there a way to tell RSS to include xrowcdn URLs or viceversa? to tell xrowcdn to include RSS to the list of modified URLs for wrapped images?

Thursday 20 September 2012 7:24:38 pm

I have to apologize - I've had you going down the wrong track here.

The rss module dumps output directly and exists, rather than returning a $moduleResult['content'] variable to index.php (which would then be processed by output filter). I did not know that until I investigated...

I would consider this an oversight by ez - anybody else have an opinion on this?

I'm afraid your best bet may to override the image output tpl and put a switch in along the lines of

 {if eq(module_params()['module_name'],"rss")}

when outputting img src urls, and append the CDN domain manually there.

Either that or you can write a better rss module...

Modified on Thursday 20 September 2012 7:27:05 pm by David Broadfoot

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from