Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-09-14 00:01:10

voodoobill
New Member
Registered: 2009-09-12
Posts: 3

Newbie confused:loading and using Javascripts

Hey Guys,
So, I’ll admit I’m really green and still feeling my way around Textpattern but I’m stumped on this one and there doesn’t really seem to be a straight answer out there.
Where or how do I load Javascripts? I take it I need to create a folder (and what do I call it?) in the root directory via Filezilla but after that I’m a little confused as to how I implement them. I take it from other snippets of info I’ve been able to glean that in either the ‘admin’ or ‘presentation’ tabs there should be a jscript subsection but I seem to be lacking this. Am I missing a plug-in that will enable a javascript subsection to be shown in one of these tabs?

Offline

#2 2009-09-14 00:14:46

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: Newbie confused:loading and using Javascripts

javascript can be loaded using the style tab, but if you’re just starting out then don’t do that. you can load a javascript file in the <head> section of a page in presentation.
<SCRIPT SRC=“login.js” language=“JavaScript/text”>
</SCRIPT>

you can make a folder called /js in your root if you want to put the file in there. if the page is in a subsection of your txp site you have to make it <txp:link_to_home />js/file.js

if you install web developer toolbar there’s a feature called view javascript which helps you see if the file is loaded or not.

Offline

#3 2009-09-14 05:40:17

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: Newbie confused:loading and using Javascripts

if you want a javascript tab in the admin area, you can try this plugin

Offline

#4 2009-09-14 08:32:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: Newbie confused:loading and using Javascripts

mrtunes wrote:

<SCRIPT SRC=“login.js” language=“JavaScript/text”></SCRIPT>

Or, slightly more accurately if you’ve made a js directory in your Textpattern’s root folder ;-)

 <script src="/js/login.js" type="text/javascript"></script>

You can also include “/textpattern/jquery.js” to get the benefit of jQuery on your sites. Or, as iblastoff says, there’s that old plugin which is quite handy, if a little slower than direct access via the script tag.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2009-09-14 21:45:03

voodoobill
New Member
Registered: 2009-09-12
Posts: 3

Re: Newbie confused:loading and using Javascripts

Excellent, thanks guys. Worked a charm with Blastoff’s recomended plug-in.

Offline

Board footer

Powered by FluxBB