Search

I have a PHP page that needs to be pulled into a Symphony page, and I’m not familiar enough with the syntax/concepts of Symphony to get it working. I created a separate PHP script as described here in comment #5: http://getsymphony.com/discuss/thread/56683/#position-5

But I’m not sure what goes in each field when creating the Dynamic XML data source, and I’m not sure what the syntax is to include a dynamic XML data source in a Page.

You just need the URI to the PHP script you have written, so long as it outputs valid XML…

If you want to, you can use xPath to pull specific nodes that you want from your PHP generated XML.

I created a separate PHP script as described here in comment…

So to confirm, you have this PHP script which returns a valid XML document, with the include file within a CDATA section? If you view the output of this script in your browser (e.g. Firefox) then it is correctly rendered as an XML DOM tree without errors.

But I’m not sure what goes in each field when creating the Dynamic XML data source

There is a short description of Dynamic XML DSs on the Data Source concept page. Here’s what each field does:

  • Name is the name you give to your Data Source. If you call it “My Data Source” then it will appear in your page XML as <my-data-source>.
  • URL is the URL of the XML feed to use. In this case, it would be the URL to your PHP script that it providing your include file as XML
  • Namespace Declarations you don’t need to worry about. Some feeds such as Atom use XML namespaces, but usually you won’t need this
  • Included Elements allows you to pick and choose which elements from the incoming XML feed to include in the XML that is shown to your page. For example if you had an RSS feed of blog posts you might only want to include each <item> element rather than the entire feed, so the Included Elements would have the XPath: /channel/item
  • Update cached result is how often your feed will be re-cached. It is not requested every page load, to keep performance good. 1 is the minimum value.

So you should be able to provide a Name, paste in the URL of your PHP script, and leave the other fields with their default values.

I’m not sure what the syntax is to include a dynamic XML data source in a Page

Just like any other Symphony Data Source. Create the DS, and it’ll appear in the “Data Sources” list when you edit a page. This is where you attach it to your page. Once attached, view the page in your browser and append ?debug to the URL to view the full page XML. Your Dynamic DS’s XML will be in there.

The Say Hello to the World tutorial has a step about integrating a Twitter feed using a Dynamic XML data source which repeats what I’ve just said.

Super helpful. Thank you. I got it to work, but now I see it works in a different way than I was thinking. The PHP page I’m trying to pull in is a form where the user fills in their contact info, credit card info, and uploads a file. When the user submits the form, their credit card is charged and, assuming the charge succeeds, their contact info and uploaded file are emailed to an admin email address. If their credit card is declined, they’re re-presented with the form to correct billing info and so on. The form functions on it’s on currently. Is there a way to embed it in Symphony in a way that retains the functionality?

Embed the script as you do now, so that the <form> appears in your XML (and therefore can be written into your page HTML). Then modify the form action attribute value to point to your PHP script URL. This means the form will be in your Symphony page, but it will still post to the original script. You’ll then want the script to redirect the user back to a Symphony page on success/failure.

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