Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2021-01-14 16:45:55

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,633
Website GitHub Twitter

Re: [SOLVED] site data in XML

Further to Oleg’s suggestion can try the code below? If the data is in the excerpt, just change body to excerpt. You may need to read about the possibilities of including html in xml. Check this intro from wikipedia.

<?xml version = "1.0"?>
<products>
<txp:article_custom section="tooted" category="aeda-ja-garaazi" limit="999">
<product>
   <title><txp:title /></title>
   <image><txp:article_image /></image>
   <description><txp:body /></description>
</product>
</txp:article_custom>
</products>

Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#14 2021-01-14 19:11:20

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,633
Website GitHub Twitter

Re: [SOLVED] site data in XML

ps. If you do not require an ‘embedded’ image, <image><txp:article_image /></image> should be replaced with

<image>
<txp:variable name="ai"><txp:custom_field name="article_image" /></txp:variable>
<txp:images id='<txp:variable name="ai" />'>
<txp:site_url />images/<txp:variable name="ai" /><txp:image_info type="ext" />
</txp:images>
</image>

Remember to delete the line-breaks to allow for a better xml presentation.


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#15 2021-01-15 13:56:53

Gallex
Member
Registered: 2006-10-08
Posts: 1,202

Re: [SOLVED] site data in XML

colak wrote #328168:

Further to Oleg’s suggestion can try the code below? If the data is in the excerpt, just change body to excerpt. You may need to read about the possibilities of including html in xml. Check this intro from wikipedia.

<?xml version = "1.0"?>...

looks perfect to me!
huge thank you colak and oleg!

Last edited by Gallex (2021-01-15 14:07:48)

Offline

#16 2021-01-15 15:09:24

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,633
Website GitHub Twitter

Re: [SOLVED] site data in XML

You may want to change <?xml version = "1.0"?> to <?xml version="1.0" encoding="UTF-8"?> as you are not using only Latin characters.

And it validates too:)

www.w3schools.com/xml/xml_validator.asp


Yiannis
——————————
neme.org | hblack.net | State Machines | NeMe @ github
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB