Felix,

        That worked perfectly, BTW. Thanks for the help!

        -Josh

On Sep 26, 2008, at 9:04 AM, Felix Meschberger wrote:

Hi,

Remember

Joshua Oransky schrieb:
I tried this... oddly, it DID load the esp, but as text... so in
functions.esp i have  test function:

function test() {
   return "HELLO";
}

Rember that ".esp" stands for ECMAScript Server Pages, thus it is
templating. So either you call the function script .ecma or enclose the
ECMAScript code in <% %> to have it executed, e.g.:

 <%
 function test() {
     return "HELLO";
 }
 %>

Regards
Felix


I actually get the code spit out as a string, rather than executed...

-Josh

On Sep 26, 2008, at 8:13 AM, Bertrand Delacretaz wrote:

On Fri, Sep 26, 2008 at 12:27 AM, Joshua Oransky <[EMAIL PROTECTED]>
wrote:

...How can I create reusable code snippets?...

In esp scripts you should be able to use the load() function:

<% load("somerelativepath/somescript.esp"); %>

see examples under

http://svn.eu.apache.org/repos/asf/incubator/sling/trunk/launchpad/testing/src/test/resources/integration-test/esp-load


main.esp includes included-a.esp which in turn includes included- b.esp.

Details are in the corresponding test case
http://svn.eu.apache.org/repos/asf/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/EspLoadTest.java


-Bertrand



Reply via email to