Search

Hi All, new here. I have been looking around for a CMS to handle auto-importing of affiliate product feeds, normally XML based, and stumbled on Symphony.

Question is, is using Symphony this way the right choice? Data feeds can sometimes be fairly large (depending on the structure and number of products, between 4MB and 15MB)

I have tested the XML importer ext'n with a wordpress RSS feed and it worked nicely. Have others used Symphony to handle XML affiliate data?

EDIT:

Yes it can import product feeds (from Affiliate Window) although not in gzip format though, not really a big issue as I can overcome that one.

I am stuck however on getting to the data in a template, partly as I still don't fully understand the way Symphony builds templates (it's only been 4 hours of using it)

debug is at http://www.shophomeaccessories.co.uk/?debug

Hello and welcome.

debug is at http://www.shophomeaccessories.co.uk/?debug

Well, ?debug is accessible only for loged-in users so use pastie or something else to post code.

I am stuck however on getting to the data in a template, partly as I still don't fully understand the way Symphony builds templates

Did you import the Feed in a Section? If so, you must create a Datasource that pulls data from that section and attach it (the Datasource) to Phillip Morris Page. After you have done this, in http://www.shophomeaccessories.co.uk/phillip-morris?debug view (debug for phillip-morris page) you will see the output of all your Datasources attached to that page.

If Datasource is named Foo bar : fooagain, XPath to data will be /data/foo-bar-fooagain.

Have a look at this image. One image worths 1000 words ;)

Welcome Oliver.

What you're wanting to achieve is certainly possible. Importing is easiest with the XML Importer extension, which chomps through an XML file and stores the data into sections (Symphony's own database structure).

Probably best start with the beginner's explanation and the Say Hello to the World tutorial which guides you through the process of making a section, adding fields, making a page, adding a data source, and writing the template XSLT.

Yep followed the hello world tut in this example, http://pastie.org/pastes/2552467/text?key=vdpqsc9tutkhbtysfhr41w

If Datasource is named Foo bar : fooagain, XPath to data will be /data/foo-bar-fooagain.

I was stuck at this point, getting the template to display the info in the XML data. I come from a world of smarty template tags so was perhaps looking for a crib sheet of XML tags that would display various things, or explain what each of the tags might do. I know due to symphony's nature the data contained in XML will be different for every project. Consider for example some of the tags from the breadcrumb xslt util

<xsl:template match="page" mode="breadcrumb">
<xsl:param name="base-url" select="'/'"/>
<xsl:choose>
<xsl:when>
<xsl:otherwise>
<xsl:apply-templates>

I am guessing I need to read up on XML first before.

What do you think to xmlimporter chomping through 5MB XML files on a typical shared hosting account?

okay dokey, think i've got it now (with some http://www.w3schools.com/xpath/xpath_syntax.asp)

 <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:output method="xml"
    doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    omit-xml-declaration="yes"
    encoding="UTF-8"
    indent="yes" />

 <xsl:template match="/">
    <html>
        <head>
            <title>Hello World!</title>
        </head>
        <body>
            <h1>Hullo</h1>
            <h2>Greetings</h2>
            <ul>
                <xsl:apply-templates select="//phillip-morris-aw-feed/productname/entry"/>
            </ul>
        </body>
    </html>
 </xsl:template>

 <xsl:template match="//phillip-morris-aw-feed/productname/entry">
    <li><h2><xsl:value-of select="productname"/></h2><xsl:value-of select="productdesc"/><br />£ <xsl:value-of select="buynow"/> <a href="{url}/">Buy Now</a> <br /><img src="{thumb}"/></li>
 </xsl:template>

 </xsl:stylesheet>

Gives me http://shophomeaccessories.co.uk/phillip-morris/

Hey Oliver,

If your Product description is using HTML markup, you could use copy-of instead of value-of:

<xsl:copy-of select="productdesc"/>

So any markup within your textarea will be output to the page. if you use value-of only the text data is rendered.

Thanks moonoo, will try it, just need to get my head around XML and xPath. I didn't even know that copy-of was a built in XSL function, I thought it was something that symphony chucked out from its architecture. You see my lack of knowledge so far, which is fine, we all start somewhere!

This might help explain things: Symphony returns an XML document (you can see it with ?debug) for each page. You transform this XML into HTML using XSLT. That transformation (templating layer) is XSLT 1.0, which is a web standard. XSLT is nothing more than a set of XML elements prefixed with the "xsl" namespace, which have special meaning when interpreted by the XSL processor on your server. XSLT also includes some functions such as "string-length(...)" or "number(...)" for certain things. XPath is a syntax for selecting XML elements by specifying their position in the XML tree.

Hope that helps clear up some of the terms: XML, XSLT, Xpath and functions :-)

Yeh @essexboyracer, what guru @nickdunn said :)

Thanks guys for the help, now onto the next challenge, to split up large XML files (4MB - 15MB) into smaller chunks for xmlimporter to process.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details