<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: reusing macros on webscripts in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120700#M85064</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried 'include'…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://fmpp.sourceforge.net/freemarker/ref_directive_include.html" rel="nofollow noopener noreferrer"&gt;http://fmpp.sourceforge.net/freemarker/ref_directive_include.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't tried it myself, but if your templates are part of a webscript, the include path should be relative to one of the web script search paths e.g. Data Dictionary/Web Scripts&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have a go, and let us know.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Jan 2008 21:21:42 GMT</pubDate>
    <dc:creator>davidc</dc:creator>
    <dc:date>2008-01-08T21:21:42Z</dc:date>
    <item>
      <title>reusing macros on webscripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120698#M85062</link>
      <description>Hi,I've lots of scripts that are using macros to output content metadata as xml.The problem i'm facing is that, in every template i've to do the same output, i've in the .ftl file repeated (copy &amp;amp; paste) all the macros i need. When i need to change one , i've to change all the files where i'm us</description>
      <pubDate>Tue, 08 Jan 2008 18:22:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120698#M85062</guid>
      <dc:creator>dloureiro</dc:creator>
      <dc:date>2008-01-08T18:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: reusing macros on webscripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120699#M85063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;i found this from freemarker&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://fmpp.sourceforge.net/freemarker/ref_directive_import.html" rel="nofollow noopener noreferrer"&gt;http://fmpp.sourceforge.net/freemarker/ref_directive_import.html&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;Example:&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;#import "/libs/mylib.ftl" as my&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;@my.copyright date="1999-2002"/&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but canÃ‚Â´t find a way to use it on alfresco&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jan 2008 19:25:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120699#M85063</guid>
      <dc:creator>dloureiro</dc:creator>
      <dc:date>2008-01-08T19:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: reusing macros on webscripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120700#M85064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Have you tried 'include'…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://fmpp.sourceforge.net/freemarker/ref_directive_include.html" rel="nofollow noopener noreferrer"&gt;http://fmpp.sourceforge.net/freemarker/ref_directive_include.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't tried it myself, but if your templates are part of a webscript, the include path should be relative to one of the web script search paths e.g. Data Dictionary/Web Scripts&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have a go, and let us know.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jan 2008 21:21:42 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120700#M85064</guid>
      <dc:creator>davidc</dc:creator>
      <dc:date>2008-01-08T21:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: reusing macros on webscripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120701#M85065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks david for the quick reponse.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The include directive seems ok and do what i want&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After trying the include directive, i've found that the relative paths doesn't seem to be working (maybe due to internationalization problems - my alfresco is in Portuguese).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The solution i will use is&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;#include "*/macros.get.xml.ftl"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and to call the macro&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;@printdocprops doc=document /&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Keep the good work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 10:55:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120701#M85065</guid>
      <dc:creator>dloureiro</dc:creator>
      <dc:date>2008-01-09T10:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: reusing macros on webscripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120702#M85066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok, at some point, I'll try out relative paths and see what happens.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 11:38:35 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120702#M85066</guid>
      <dc:creator>davidc</dc:creator>
      <dc:date>2008-01-09T11:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: reusing macros on webscripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120703#M85067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;after some tests, (I've tested on a alfresco machine in english too)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;here is my conclusion:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- the relative paths&amp;nbsp; aren't working&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; if i start the path like Data Dictionary/Scripts the real path used by import is &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;current space path&amp;gt;/Data Dictionary/Scripts&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if i start the path like&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/somespace/somespace/&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if my script is in Data Dictionary/Scripts the real path used is&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Data Dictionary/Scripts/somespace/somespace/&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;if my script is in Data Dictionary/Web Scripts the real path used is&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Data Dictionary/Web Scripts/somespace/somespace/&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i can't access a script from Data Dictionary/Scripts&amp;nbsp; from a script within&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Data Dictionary/Web Scripts&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the import directive woks fine too, the problem was the path &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the // in the path, works too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;#import "/logical/staging/macros.get.xml.ftl" as my&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jan 2008 13:14:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120703#M85067</guid>
      <dc:creator>dloureiro</dc:creator>
      <dc:date>2008-01-09T13:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: reusing macros on webscripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120704#M85068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;i found this from freemarker&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://fmpp.sourceforge.net/freemarker/ref_directive_import.html" rel="nofollow noopener noreferrer"&gt;http://fmpp.sourceforge.net/freemarker/ref_directive_import.html&lt;/A&gt;&lt;BR /&gt;Example:&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;lt;#import "/libs/mylib.ftl" as my&amp;gt;&lt;BR /&gt;&amp;lt;@my.copyright date="1999-2002"/&amp;gt;&lt;BR /&gt;&lt;BR /&gt;but canÃ‚Â´t find a way to use it on alfresco&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;The full path to the ftl to include should work?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Kevin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2008 17:23:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120704#M85068</guid>
      <dc:creator>kevinr</dc:creator>
      <dc:date>2008-01-21T17:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: reusing macros on webscripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120705#M85069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;hi kevin,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for the replay.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i don't know if it should work or not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Full paths like&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/Company Home/Data Dictionary/Web Scripts/mylib.ftl&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;doesn't work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It would be nice if we can reference a lib by the full path too…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2008 10:23:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120705#M85069</guid>
      <dc:creator>dloureiro</dc:creator>
      <dc:date>2008-01-22T10:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: reusing macros on webscripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120706#M85070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try this: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;#include companyhome.childByNamePath["Data Dictionary/Web Scripts/My Template.ftl"].nodeRef&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jan 2008 18:18:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120706#M85070</guid>
      <dc:creator>mikef</dc:creator>
      <dc:date>2008-01-22T18:18:54Z</dc:date>
    </item>
    <item>
      <title>Re: reusing macros on webscripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120707#M85071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just to clarify this, Freemarker includes work differently depending on where you are using them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Web Scripts&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want it use includes in &lt;/SPAN&gt;&lt;STRONG&gt;Web Scripts&lt;/STRONG&gt;&lt;SPAN&gt; you should use paths relative to the Web Script classpath e.g.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;#include "/demo/include/include.ftl"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Where the class path is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 1.&amp;nbsp; repository folder: /Company Home/Data Dictionary/Web Scripts Extensions&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 2. repository folder: /Company Home/Data Dictionary/Web Scripts&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 3. class path folder: /alfresco/extension/templates/webscripts&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; 4. class path folder: /alfresco/templates/webscripts &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Please Note: Do not store web scripts in /org/alfresco or any of its subfolders. These folders are reserved for Alfresco use.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Custom Views/Direct Execution etc&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want to use includes in Freemarker outside of a web script, such as a Custom View you should use something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;#include companyhome.childByNamePath["Data Dictionary/Web Scripts/My Template.ftl"].nodeRef&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 12:58:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120707#M85071</guid>
      <dc:creator>mikef</dc:creator>
      <dc:date>2008-01-29T12:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: reusing macros on webscripts</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120708#M85072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Web Scripts&lt;BR /&gt;If you want it use includes in &lt;STRONG&gt;Web Scripts&lt;/STRONG&gt; you should use paths relative to the Web Script classpath&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt;Thanks mike for clarifying this. Now i understand the correct behavior. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 15:12:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/reusing-macros-on-webscripts/m-p/120708#M85072</guid>
      <dc:creator>dloureiro</dc:creator>
      <dc:date>2008-01-29T15:12:34Z</dc:date>
    </item>
  </channel>
</rss>

