Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: spf_js - JavaScript management - create, edit, delete, export to file
Version 0.5 released for Textpattern >= 4.5.1
Offline
Re: spf_js - JavaScript management - create, edit, delete, export to file
Hi Simon,
I have a problem with new version: 0.5
I have tried instal into a new TXP installation and the plugin not create the prefs field.
So, it show the default script but not save or alter it and I can’t create a new script.
I solved installing version 0.4 and then update to 0.5.
Offline
Re: spf_js - JavaScript management - create, edit, delete, export to file
MarcoK wrote:
I have tried instal into a new TXP installation and the plugin not create the prefs field.
Hi Marco
Thanks for spotting that .. a new version will be out very soon.
EDIT: fixed version (v0.51) out now.
Simon
Last edited by spiffin (2012-11-07 20:42:44)
Offline
#40 2014-12-01 22:09:02
- Derekstaff
- Member
- Registered: 2014-10-23
- Posts: 28
Re: spf_js - JavaScript management - create, edit, delete, export to file
I’m having a difficult time getting spf_js to work on my site. As I’ve mentioned in other threads, this is my first time working with more than bare html and css sites, so forgive me if I’m being a bit dense, missing something obvious.
I’m currently developing on my server in a subdirectory (www.mydomainname.com/test) while I work on the site upgrade. The Textpattern installation/directory is in the “test” subdirectory. When the Github page for the plugin states:
“Create a directory for the static JavaScript files in the root of your textpattern installation. You should make sure that PHP is able to write to that directory.”
That means I would put the “js” directory in the “test” directory, correct? Because, for the purposes of developing this upgrade, “test” is the root, right? Or do I put the “js” directory in the “textpattern” directory within the “test” directory?
When the Github page instructions say:
“Visit the Advanced Preferences (Admin > Preferences > Advanced) and make sure the “JavaScript directory” preference contains the directory you created in step 1 (by default ‘js’). “
That means I would put “www.mydomainname.com/test/js” as the path in the Javascript entry under Advanced Preferences, correct?
Thanks for helping me understand.
Offline
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
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
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
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