xmlfeed Tumblr

basic functions and we:tags
Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

xmlfeed Tumblr

Beitragvon Michael_S » Mi 29. Jun 2011, 12:34

Hi,

I would like to integrate a Tumblr feed into a webEdition site but cannot find any information in the forum which helps with the xmlfeed and xmlnode syntax. Please can someone help me with a basic example to get me started.

Thanks in advance.

Michael.
Production Area
London, UK
http://productionarea.com

ThomasGoebe

Re: xmlfeed Tumblr

Beitragvon ThomasGoebe » Mi 29. Jun 2011, 17:09

Hello Michael,

here is an old and simple demo for xmlfeed / xmlnode. Perhaps it can get you started:

Code: Alles auswählen

<we:xmlfeed name="rssFeed" url="http://www.golem.de/rss.php?feed=RSS2.0" refresh="0" />
<we:xmlnode feed="rssFeed" xpath="/rss/channel">
  <h1><we:xmlnode feed="rssFeed" xpath="title"></we:xmlnode></h1>
  <h2><we:xmlnode feed="rssFeed" xpath="description"></we:xmlnode></h2>
  <ul>
    <we:xmlnode xpath="item">
      <li>
        <a href="<we:xmlnode xpath="link"></we:xmlnode>" target="_blank">
          <we:xmlnode xpath="title"></we:xmlnode>
        </a>
      </li>
    </we:xmlnode>
  </ul>
</we:xmlnode> 
The source of this example is an old site with webEdition hints (we will integrate the content of that site into webedition.org as soon as there is more free time): http://we-devedge.de/tags/index.php?we_objectID=849

best regards
Thomas

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Re: xmlfeed Tumblr

Beitragvon Michael_S » Mi 29. Jun 2011, 19:20

Hi Thomas,

Thanks for the code sample, I have it working along those lines and the data from the feed is correctly formatted as illustrated below but my webEdition code results nodes being duplicated? I'm sure this will be a simple formatting problem but I can't find any pointers or examples.

Code: Alles auswählen

<tumblr version="1.0">
<tumblelog name="..." timezone="US/Eastern" title="..."/>
	<posts start="0" total="...">
		<post 
			id="..." 
			url="..." 
			url-with-slug="..." 
			type="html" 
			date-gmt="..." 
			date="..." 
			unix-timestamp="..." 
			format="..." 
			reblog-key="..." 
			slug="...">
			<regular-title>...</regular-title>
			<regular-body>...</regular-body>
		</post>
	</posts>
</tumblr>
The code below results in each node being repeated on the same line 3 times and then individually as expected, for example 2 html formatted posts gives me ...

[regular-title 1] [regular-title 2]
[regular-body 1] [regular-body 2]
[regular-title 1] [regular-title 2]
[regular-body 1] [regular-body 2]
[regular-title 1] [regular-title 2]
[regular-body 1] [regular-body 2]
[regular-title 1]
[regular-body 1]
[regular-title 2]
[regular-body 2]

Code: Alles auswählen

<we:xmlfeed name="tumblrFeed" url="http://(You).tumblr.com/api/read" refresh="0" />

<we:xmlnode xpath="/tumblr" feed="tumblrFeed">
	<we:xmlnode xpath="/posts">
		<we:xmlnode xpath="/post">
			<we:xmlnode xpath="/regular-title"></we:xmlnode><br />
			<we:xmlnode xpath="/regular-body"></we:xmlnode><br /><br />
		</we:xmlnode>
	</we:xmlnode>
</we:xmlnode>
Regards,

Michael.
Production Area
London, UK
http://productionarea.com

Michael_S
Senior Member
Beiträge: 160
Registriert: Mi 4. Feb 2004, 02:39
Wohnort: London / UK
Kontaktdaten:

Re: xmlfeed Tumblr

Beitragvon Michael_S » Mi 29. Jun 2011, 22:32

Ok, I'm making some progress. To remove the duplication of nodes I needed to include the full xpath for the posts and post. Now I would like to limit the rows and include some logic ideally using something like ifVar, ifVarEmpty and ifVarNotEmpty.

1. Can anyone let me know how I can limit the rows requested by xmlfeed or displayed by xmlnode?
2. Is there a way to use if we:tags to apply logic to a xmlnode?

Code: Alles auswählen

<we:xmlfeed name="tumblrFeed" url="http://(You).tumblr.com/api/read" refresh="0" />

<we:xmlnode xpath="/tumblr" feed="tumblrFeed">
	<we:xmlnode xpath="/tumblr/posts">
		<we:xmlnode xpath="/tumblr/posts/post">
			<h3><we:xmlnode xpath="regular-title"></we:xmlnode></h3>
			<we:xmlnode xpath="regular-body"></we:xmlnode><br /><br />
		</we:xmlnode>
	</we:xmlnode>
</we:xmlnode>
Thanks,

Michael.
Production Area
London, UK
http://productionarea.com


Zurück zu „Creating templates“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 5 Gäste