Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-01-13 10:56:06

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

[SOLVED] site data in XML

my client website has products page. now he wants all the data in that product page (each product has title, description and images) as XML file. how i get this?

Offline

#2 2021-01-13 12:02:11

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: [SOLVED] site data in XML

Are you trying to import or to export data to/from txp?

Offline

#3 2021-01-13 12:05:18

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

Re: [SOLVED] site data in XML

etc wrote #328144:

Are you trying to import or to export data to/from txp?

export

Offline

#4 2021-01-13 12:18:06

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: [SOLVED] site data in XML

First create a XML form type in Advanced options/Custom form template types:

[xml]
mediatype="text/xml"
title="XML"

Then create a XML form (say products) like

<?xml version = "1.0"?>
<products>
<txp:article_custom>
<product>
   <title><txp:title /></title>
   <description><txp:meta_description format="" /></description>
   ...
</product>
</txp:article_custom>
</products>

You should be able to access it via ?f=products now.

Offline

#5 2021-01-13 13:13:05

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

Re: [SOLVED] site data in XML

<?xml version = “1.0”?>
<products>
<txp:article_custom>
<product> <title><txp:title /></title> <description><txp:meta_description format=”“ /></description> …

by the product description I meant – text inside the body. is it correct then:

<title><txp:title /></title>
   <description><txp:body /></description>

but images?

Offline

#6 2021-01-13 13:13:05

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: [SOLVED] site data in XML

… I’m so curious Oleg. And now: if the question was how to import?

Last edited by Pat64 (2021-01-13 13:15:00)


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#7 2021-01-13 13:18:35

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: [SOLVED] site data in XML

Gallex wrote #328147:

but images?

I don’t think you can (without encoding them). Include just their URL?

Pat64 wrote #328148:

… And now: if the question was how to import?

smd_xml or etc_query?

Offline

#8 2021-01-13 13:48:42

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

Re: [SOLVED] site data in XML

etc wrote #328146:

Then create a XML form (say products) like

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

You should be able to access it via ?f=products now.

oleg, this is not at all what i would like. i would like to export this page as XML.
your solution produces this
some page titles and one multiplied page description

Offline

#9 2021-01-13 14:06:30

etc
Developer
Registered: 2010-11-11
Posts: 5,053
Website GitHub

Re: [SOLVED] site data in XML

Gallex wrote #328150:

some page titles and one multiplied page description

What do you want — I had no idea of how meta_description tag works :-) Try with <txp:body /> or

<txp:custom_field name="description" />

And probably replace article_custom with article to filter by section.

Offline

#10 2021-01-13 14:13:36

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,599
GitHub Twitter

Re: [SOLVED] site data in XML

@etc: Ok. With the help of a plugin (I thought you do it with some native TXP magic inside) :D


Patrick.

Github | CodePen | Codier | Simplr theme | Wait Me: a maintenance theme | [\a mi.ni.ma]: a “Low Tech” simple Blog theme.

Offline

#11 2021-01-13 15:15:31

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

Re: [SOLVED] site data in XML

Is the https://kenovoeesti.ee/tooted/aeda-ja-garaazi/ page an article or a category? The reason I am asking is because it finishes with / which implies that it is not an article. It is good to know if aeda-ja-garaazi is a category and if tooted is a section.

Also…

  • Are the images loaded via article_image ?
  • In case it is a category, Do you expect the data of the tables to be included in the xml?

Last edited by colak (2021-01-13 15:58:12)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#12 2021-01-14 09:15:42

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

Re: [SOLVED] site data in XML

colak wrote #328155:

It is good to know if aeda-ja-garaazi is a category and if tooted is a section.

you are absolutely correct – aeda-ja-garaazi is a category and tooted is a section.

  • Are the images loaded via article_image ?

yes

  • In case it is a category, Do you expect the data of the tables to be included in the xml?

yes

Offline

Board footer

Powered by FluxBB