How do I use PHP inside a XML block?

Chris's Avatar

Chris

22 Feb, 2011 04:39 AM

I have a page that is using a separate file Format for .xsl style and a separate file Block for xml data. How can I invoke PHP?

All the problems are happening in the Block. I've tried the following methods of testing.

The below works fine and will spit out on the page correctly (with the .xsl's style).





The following does not work. The PHP doesn't seem to output.





<!--#START-CODE<?PHP echo '<server name="delta" online="False" />';<br/> ?>#END-CODE-->

The following also does not work. The PHP doesn't seem to output.

<system-xml>

<!--#START-CODE<?PHP echo '<server name="delta" online="False" />';<br/> ?>#END-CODE-->
</system-xml>

What I'm ultimately trying to do is have the Cascade page pull XML data from a Block that uses PHP to populate XML data that is fetched from the server's APC cache.

1) Cascade page hits Block
2) Block uses PHP to fetch data from a URL.
3) Data is cached in APC.
4) Data is used on page load to send XML data back to the Cascade page to style with the Format (.xsl).

  1. 1 Posted by Chris on 22 Feb, 2011 04:41 AM

    Chris's Avatar

    Heh, guess the discussion board doesn't like XML tags -- or maybe I should've wrapped them with some kind of [code] BBCode that I wasn't aware of. Anyhow, here's the post in its full glory:
    http://pastebin.com/7KTKT5JH

  2. 2 Posted by Timothy Gilman on 17 Mar, 2011 09:19 PM

    Timothy Gilman's Avatar

    Hi Chris,

    I'm pretty sure you can't execute php within Cascade. In order to accomplish what you are trying to do, my thoughts would be along these lines.

    1. Create a feed block in Cascade to fetch the data from the URL.
    2. (If necessary, write an intermediary php script to process the data and create an xml feed. Then point the feed block to that.)
    3. Use that feed block in the page region, and use the format to style the xml data.

    Hope that helps.

    Timothy

  3. Tim closed this discussion on 21 Jun, 2011 03:43 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac