JavaScript Mehtod Library

Hi
i know how to include PHP Libraries in my App’s. Very nice :slight_smile:

But how can i add my Javascripts Methods as a Library. I’m tired to write same code twice.

Thank’s for your help.
Best regards
Steve

Easy.

echo <script src="yourlibrary" type="text/javascript"></script>;

Hi
thank’s for the answer. Is there also a trick to do the library in sc. Everytime a write a JS Funktion, it sets me autocratically the <php ?> tags to the file.
To do by Hand (upload the file with ftp) is not so sexy, because i have different deployment location.

Best regards
Steve

[QUOTE=stephanw;31350]Hi
thank’s for the answer. Is there also a trick to do the library in sc. [/QUOTE]

In macros exists sc_include_lib where you can include JS libraries, but don’t know where you have to place it, never used it.
I always place my external custom code on a folder, and take care to deploy this folder with my projects.

Everytime a write a JS Funktion, it sets me autocratically the <php ?> tags to the file.

Don’t understand this.

To do by Hand (upload the file with ftp) is not so sexy, because i have different deployment location.

Best regards
Steve

You have to deploy manually sorry.

[QUOTE]Everytime a write a JS Funktion, it sets me autocratically the <php ?> tags to the file.

Don’t understand this.
[/QUOTE]

In Tools=> Libraries i can make a new project library and edit it. I thought maybe i can write the file there, include it with your trick above and everything fine. I think the .php extension from the file is not a problem, even it’s a js-library.
But SC everytime writes the <php ?> tags around my js code. So i can not use it as a js file.

Best regards
Steve

Because this section is for PHP libs not JS, for this reason file is wrapped with PHP tags.