RSS export and flash

Author Message

Steph A

Tuesday 07 February 2006 11:58:04 am

Im trying to make ez communicate with a .swf file in my template. I have managed to import text through the RSS output - but I would like the full url for the image also. So that this can be implemented into the .swf

Now the RSS just shows <Object> when I choose the class and attribute, and no url.

Any ideas?

Łukasz Serwatka

Tuesday 07 February 2006 11:21:05 pm

Hi Steph,

Take a look at this topic, you will find some useful ideas
http://ez.no/community/forum/general/dynamic_flash_menu/re_dynamic_flash_menu

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Steph A

Wednesday 08 February 2006 6:59:06 am

Nothing to find there I think. But thanx.

I just need to know how to force the RSS feed to output a url to the full-version image-attribute of my class.

If I set "Title" in the RSS feed to my "Image"-attribute of the class - I would like to output the full url to this image in the feed, so that I can import this with a XML-connector in Flash. Iam not a hardcore Ez or Flash programmer, but I think this is the way to go - or am I just heading the wrong way here?

any inputs or other suggestions would be deeply appriciated....

Steph A

Wednesday 08 February 2006 2:27:00 pm

Is there really nobody that knows or have tried to output link to images in the RSS feed?

I am really struggling with this, and any help would be appriciated....

:)

Łukasz Serwatka

Wednesday 08 February 2006 11:37:12 pm

Nothing to find there I think. But thanx.

Steph, one of ideas from given link above was to use layout module, then you have full control on the ouput because it is template base so you can construct your feed as you want, only one file to hack /kernel/layout/set.php where you have to add xml header "header( 'ContentType=text/xml' );"

If you want to hack RSS output look on file where feed is construct.
kernel/classes/ezrssexport.php

Other way you can create your new module, this will be correct way to handle this. However using layout module is faster ;)

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Steph A

Thursday 09 February 2006 2:11:36 am

Well, I looked at that. But it seems to me that this way would be to slow. There will then be two calls to the ezsystem - both with template prossesing etc.... will it not? Iam trying out this solution right now - and will be back with the results...

I would be more interested in just hacking the typical RSS feed as it is. But the knowlegde to do so - is the problem.

Just one (or two) questions: Whats happends when the RSS output shows <object> where there should be a image? and is there any easy way to hack around this?

This is really all I need - just to be able to show url to images, then all my needs are filled :)

Łukasz Serwatka

Thursday 09 February 2006 2:38:18 am

Iam not a hardcore Ez or Flash programmer, but I think this is the way to go - or am I just heading the wrong way here?

In this case, using layout module can be easiest then coding new module. Performance is good enough.

I think using RSS word is a bit confusing here, you need export data from eZ publish to XML format and read this data in other "application". The bast way is to create new module, fetch data, pack it around xml tags, send correct header, and provide as source stream to Flash. That's all. RSS is a standard you don't have to follow it, in your case enough will be

<?xml version="1.0"?>
<item>
    <img-src>path to image</img-src>
</item>

Just loop throw fetched objects and take img path. Browse forum for examples. This will be the cleanest way, without hacking kernel, so you will don't have to care about future updates.

Look also on loadVariables

http://www.actionscripts.org/tutorials/beginner/loadVariables_and_loadVars/index.shtml

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Steph A

Thursday 09 February 2006 3:25:43 am

Yes I just realized that now. Iam about to do just this now.... i just got hung up in the RSS module that already exists.

But now I have made a new xml_pagelayout.tpl override - and can now do just what I want. Its just as u said really simple :)

Thank you for explaining this for me - still a newbie :)

Stig Tidemandsen

Thursday 09 February 2006 5:56:14 am

What Lukasz Serwatka says about hacking /kernel/layout/set.php will make it easier for viewing the xml in a browser, but flash reads the xml without editing the content type. Please correct me if I'm wrong here, but won't hacking /kernel/layout/set.php this way affect other layouts like "print" and "popup"?

Łukasz Serwatka

Thursday 09 February 2006 6:03:37 am

Hi Stig,

You are right, that's why you should make it INI configuration base. ContentType per view. If you have e.g view xml then use xml contentype if print then use standard http. You will need to implement some logic.

Example can look like:

if ( $layoutINI->hasVariable( $LayoutStyle, 'ContentType' )  )
		header( 'Content-Type: ' . $layoutINI->variable( $LayoutStyle, 'ContentType' ) . ' charset=' . $i18nINI->variable( 'CharacterSettings', 'Charset' ) );

It is basically one more variable ContentType where you define it. This can be use full for alternative e.g for RSS.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Tobias Adam

Monday 29 May 2006 9:44:45 am

Hi,

I tried to do what Lukasz Serwatka suggested in his last posting but I'm not successful. Here's what I did.

In a siteaccess override for layout.ini I created this group:

[xml]
PageLayout=alb_xml_pagelayout.tpl
ContentType=text/xml

Of course I also created the template alb_xml_pagelayout.tpl which contains just some simple XML for test reasons.

Then I added the Code that Lukasz suggested into kernel/layout/set.php. That you can see where I added it, I'm showing you the line before and after my insertion:

if ( $layoutINI->hasVariable( $LayoutStyle, 'PageLayout' ) )
        $Result['pagelayout'] = $layoutINI->variable( $LayoutStyle, 'PageLayout' );

    if ( $layoutINI->hasVariable( $LayoutStyle, 'ContentType' ) )
        header( 'Content-Type: ' . $layoutINI->variable( $LayoutStyle, 'ContentType' ) . ' charset=' . $i18nINI->variable( 'CharacterSettings', 'Charset' ) );

    include_once( 'kernel/common/eztemplatedesignresource.php' );

But now, when I'm viewing a node using this layout, I'm getting this error message:

"<b>Fatal error:</b> Call to a member function on a non-object in <b>/var/albwww/ez/kernel/layout/set.php</b> on line <b>57</b>
<b>Fatal error:</b> eZ publish did not finish its request

The execution of eZ publish was abruptly ended, the debug output is present below."

I think that the usage of header() causes this problem, maybe it isn't allowed to use. But which function should I use instead? I tried to find information about setting headers etc. in this forum and the documentation, but didn't find anything.

Can anybody help me?

Kristof Coomans

Monday 29 May 2006 11:16:17 pm

Hi guys

It's $i18nINI that isn't set.

Put this before the code Lukasz gave you:

$i18nINI =& eZINI::instance( 'i18n.ini' );

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Tobias Adam

Tuesday 30 May 2006 1:15:01 am

Thanks a lot, Kristof, now it works!

Just a note to the people who try to do the same: there's a little error in Lukasz Code he posted, concerning a missing semicolon in the header field's content which causes IE to fail loading the xml (but FF does, however).

Here's the corrected code:

if ( $layoutINI->hasVariable( $LayoutStyle, 'ContentType' ) )
        header( 'Content-Type: ' . $layoutINI->variable( $LayoutStyle, 'ContentType' ) . '; charset=' . $i18nINI->variable( 'CharacterSettings', 'Charset' ) );

Łukasz Serwatka

Tuesday 30 May 2006 2:33:38 am

Hi Tobias, Kristof,

Thanks for pointing that small issue, it was just quick example. Good to see that everything works fine in real installation ;)

I will check if can have that functionality be default.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.