Re: [Catalyst] external javascript files
On Mar 24, 2008, at 2:43 PM, Jennifer Ahn wrote: i'm tyring to call my external javascript library under myapp/root/ src/myjavascript.js in my tt2 file by placing this line at the top of the tt2 file: script language=Javascript src=/myjavascript.js type=text/ javascript/script The language attribute is, IIRC, deprecated in all current X?HTML. It's best to use uri_for() with pretty much everything. It lets you do your app in a number of different ways while resolving resources correctly. So– script src=[% c.uri_for(/myjavascript.js) %] type=text/ javascript/script I have also started to make URIs relative this way when possible/ allowed– script src=[% c.uri_for(/myjavascript.js).path %] type=text/ javascript/script It's best to setup your server to serve this kind of resource instead of your app if/when you can. Check the advent calendars and tutorial docs for examples of that. You'll probably want your js files in your static path to make this easier. -Ashley ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] external javascript files
I think in your case it would be /src/myjavascript.js Thanks, -- Ali Mesdaq (CISSP, GIAC-GREM) Security Researcher II Websense Security Labs http://www.WebsenseSecurityLabs.com -- -Original Message- From: Jennifer Ahn [mailto:[EMAIL PROTECTED] Sent: Monday, March 24, 2008 2:43 PM To: The elegant MVC web framework Subject: [Catalyst] external javascript files hello! i'm tyring to call my external javascript library under myapp/root/src/myjavascript.js in my tt2 file by placing this line at the top of the tt2 file: script language=Javascript src=/myjavascript.js type=text/javascript/script is this the right way to use an external javascript file in my template file? thank you! jennifer ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ Protected by Websense Messaging Security -- www.websense.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] external javascript files
On 24.03.2008, at 22:43, Jennifer Ahn wrote: i'm tyring to call my external javascript library under myapp/root/ src/myjavascript.js in my tt2 file by placing this line at the top of the tt2 file: script language=Javascript src=/myjavascript.js type=text/ javascript/script is this the right way to use an external javascript file in my template file? I'd put myjavascript.js in root/static/js or something like that and use uri_for to make the app relocatable: script type=text/javascript src=[% Catalyst.uri_for('/static/js/ myjavascript.js') %] / --Tobias --Tobias ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/