Using the LoadXhtmlFile function with a parameter value defined in metadata

Topics: Community, General, Troubleshooting
Jun 29, 2012 at 3:29 PM

I would like to have composite recognize webpages that are edited outside of composite. To do this, I am doing the following:

1. create metatype with field type string so that users can enter the path of the webpage.

2.create a page type that recognizes this metadata field.

3.create a template which calls function A.

4. function A will get the Xml data of the current page (which has the path for the webpage to be copied from metadata). LoadXhtmlFile will then be used, grabbing the path from function A and using it in its value.

The problem is I can't get LoadXhtmlFile to run in the template. Is the template only for parsing out data? I think my function looks okay:

<f:function xmlns:f="http://www.composite.net/ns/function/1.0" name="Composite.Xml.LoadXhtmlFile">
            <f:param name="RelativePath" value="{in:inputs/in:result/importedpage/@uri}"></f:param>
</f:function>

Unfortunately the page source and preview shows the function instead of the data.

Can anyone direct me to how this is done?

Thanks,

Phil

Coordinator
Jun 29, 2012 at 8:58 PM

Hi Phil

Function LoadXhmlFile loads only physical files on disk (you can see the implementation here). You should try using Composite.Core.Xml.LoadUrl instead  

>> Unfortunately the page source and preview shows the function instead of the data.

Does it show markup of function A or something elso. Can you post here sources of template, function A and the output?

Jun 29, 2012 at 9:15 PM
Edited Jun 29, 2012 at 9:15 PM

Hi napernik,

I should have clarified - these pages are stored locally on the server.

I am attempting to call a function using another functions output as the parameter. Here is this function's template for function A:

<f:function xmlns:f="http://www.composite.net/ns/function/1.0" name="Composite.Xml.LoadXhtmlFile">
        <f:param name="RelativePath" value="{in:inputs/in:result/importedpage/@uri}"></f:param>
</f:function>

The function call in functionA is using GetXml.


Output looks like this:

<f:function name="Composite.Xml.LoadXhtmlFile" xmlns:f="http://www.composite.net/ns/function/1.0">

    <f:param name="RelativePath" value="App_Data/planning/2012/apr/bestpractice.htm"/>
</f:function>
This is right! But... i want to to perform the function, not return the text!
Coordinator
Jul 2, 2012 at 9:13 AM

I tried to reproduce the issue but everything seem to be working locally. Can you by any chance send me a copy of your website for debugging? My email is ddz (at) composite.net