Textpattern CMS support forum

You are not logged in. Register | Login | Help

#41 2014-12-01 22:39:39

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

Re: spf_js - JavaScript management - create, edit, delete, export to file

Hello

1. Put the ‘js’ directory in your root directory – in your case inside the ‘test’ directory.

2. Under Advanced Prefs just enter ‘js’ (it’s in relation to your root directory).

Simon

Offline

#42 2014-12-01 23:22:30

Derekstaff
Member
Registered: 2014-10-23
Posts: 28

Re: spf_js - JavaScript management - create, edit, delete, export to file

Thanks. Ok, that’s what I thought. I’d put the “js” directory inside of “test”, and had left the “javascript” path in the advanced setting at it’s default “js”. I made sure the plugin was installed and activated. But it doesn’t seem to be working.

I’ve installed and activated the spf_js plugin. I created a form, “js_link” which simply outputs <txp:spf_js />, and then included the tag <txp:output_form form="js_link"> on each page, so that I could quickly change the javascript link if need be.

To see if the javascript was functioning, I included this basic function to the default javascript file.
function popup() { alert("Hello World") }

And added this to my default txp page.

<input type="button" onclick="popup()" value="Click Me!">

When I checked the site in the browser, the “Click Me!” button was of course created, but I’m not getting any popup. I can’t seem to figure out what the problem is.

Offline

#43 2014-12-01 23:54:02

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

Re: spf_js - JavaScript management - create, edit, delete, export to file

You don’t need to create a form etc.

Once you’ve added your javascript to the default javascript just add <txp:spf_js /> to the relevant page template.

If you’re still having trouble, can you go to Admin > Diagnostics and tell me what is says for Document root and $path_to_site?

Last edited by spiffin (2014-12-02 00:16:44)

Offline

#44 2014-12-02 21:02:03

Derekstaff
Member
Registered: 2014-10-23
Posts: 28

Re: spf_js - JavaScript management - create, edit, delete, export to file

I understand that I don’t need to create a form for the link, but was worried that I wouldn’t get the plugin to work properly, and Figured it would be easier to change a form than to change the link on several different pages if I end up trying to deal with the javascript manually.

According to diagnostics:

Document root: /home/43/94/8309443/web
$path_to_site: /home/43/94/8309443/web/test

Thanks for trying to help me figure this out.

Offline

#45 2014-12-02 21:10:57

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

Re: spf_js - JavaScript management - create, edit, delete, export to file

Hmm .. all looks fine to me.

I set up a quick local install of Textpattern in a sub-directory to test and it works fine.

If you look at the page source can you see the javascript?

Offline

#46 2014-12-02 21:29:00

Derekstaff
Member
Registered: 2014-10-23
Posts: 28

Re: spf_js - JavaScript management - create, edit, delete, export to file

Just on a lark, I got rid of the form, and put the <txp:spf_js /> directly on the page template. The basic javascript now runs. Go figure.

I appreciate the help. I’ll start putting the more complex javascript in and see if it all continues to work.

Thanks for looking into this with me.

Offline

#47 2014-12-02 21:56:25

spiffin
Plugin Author
From: London, UK
Registered: 2004-06-08
Posts: 95
Website

Re: spf_js - JavaScript management - create, edit, delete, export to file

Your form tag wasn’t closed:

<txp:output_form form=“js_link”>

.. instead of:

<txp:output_form form=“js_link” />

Offline

#48 2014-12-02 22:15:50

Derekstaff
Member
Registered: 2014-10-23
Posts: 28

Re: spf_js - JavaScript management - create, edit, delete, export to file

Whoops! thanks for the catch.

Offline

#49 2014-12-06 22:30:36

Derekstaff
Member
Registered: 2014-10-23
Posts: 28

Re: spf_js - JavaScript management - create, edit, delete, export to file

Is it only possible to use one spf tag at a time? When I add <txp:spf_js /> just before the closing </body> tag, the javascript works fine. If I add another, such as <txp:spf_js name="shim" />, to include a shim script I created in the Javascript panel, the default script stops working.

Last edited by Derekstaff (2014-12-06 22:30:55)

Offline

#50 2014-12-07 06:55:07

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 7,344
Website

Re: spf_js - JavaScript management - create, edit, delete, export to file

Derekstaff wrote #286308:

Is it only possible to use one spf tag at a time?

Yes, I am using this plugin in all my sites. Can you post your head code or a url for us to check what might the problem be?


Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github

Offline

Board footer

Powered by FluxBB