Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#61 2018-11-08 08:10:36

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

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

ia278 wrote #315058:

Hey everyone!

I’m using 4.7.1, and installed the plugin, but can’t get it to work! So I’ve got two questions;

1. How do you make sure that PHP is able to write to the ‘js’ directory that was created in the root? I know literally nothing about PHP, is there a specific file that I’m supposed to edit?

2. I don’t have a “JavaScript directory” option in preferences – is this normal for 4.7.1, or is there a way that I can make this appear?

To anyone who answers – thank you so much!

Re the above. You have to create the JavaScript directory using ftp. Then you go to Preferences>Admin and just write JavaScript in the field named spf_js_dir.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#62 2018-11-08 13:18:00

ia278
Member
From: UK
Registered: 2018-11-07
Posts: 17
Website

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

colak wrote #315075:

Re the above. You have to create the JavaScript directory using ftp. Then you go to Preferences>Admin and just write JavaScript in the field named spf_js_dir.

Thanks for the answer Yiannis – but that’s what I’ve already done!

So far, I’ve created a ‘js’ folder in my document root (shown here), but any JavaScript files that I create aren’t being saved to this folder. And in Preferences>Admin, I don’t currently have the spf_js_dir field available (shown here). It looks the same as before I installed spf-js – and it’s definitely on! I’ve also done the standard “uninstall, reinstall” and “turn it off and on again”, without success.

In my source code, the output reads something like <script src=“https://www.example.co.uk//script.js”></script> – I’m assuming that the ‘js’ folder should be between the two slashes. Any ideas?

Thanks again!

Offline

#63 2018-11-08 14:07:59

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,011
Website GitHub Mastodon Twitter

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

What permissions did you give the directory? Did you try 775?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#64 2018-11-08 18:42:17

ia278
Member
From: UK
Registered: 2018-11-07
Posts: 17
Website

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

colak wrote #315085:

What permissions did you give the directory? Did you try 775?

It was on 755 (the same as my images and files directories). I’ve just changed it to 775, but still no luck…

Offline

#65 2018-11-17 03:55:05

ia278
Member
From: UK
Registered: 2018-11-07
Posts: 17
Website

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

Solved.

The plugin instructions ask you to create a directory for JavaScript, and then ensure that PHP can write to it. This is done by going to Preferences>Admin and writing the directory name in the field named “JavaScript directory” – but if this field doesn’t appear for you, you’ll need to create it by adding a new row to the txp_prefs table, inside the TextPattern database.

So what should this look like – and what properties/values should be included?

name: spf_js_dir. Sets the name of the field you’re creating – although in the Preferences panel, it’ll parse as “JavaScript directory”.
val: js. Should match with what you’ve called your JavaScript directory in the root of your installation.
type: 0. No idea what this does, but every other row in the “Admin” panel also has a value of 0.
event: admin. Determines which section in the Preferences panel the “JavaScript directory” option will appear in.
html: text_input. Determines the type of input the “JavaScript directory” will accept.
position: 35. Determines the chronological position of the “JavaScript directory” in the menu. Every other field has a unique number assigned to it, with the final display list ordering them from lowest to highest. 35 places “JavaScript directory” between the theme directory and the file directory path (30 & 40 respectively). This can be any number however, as long as it’s not already been used in the section set in “event”.

After creating the new row,

  • check your preferences to make sure it now appears,
  • save your JavaScript again, to create a copy in the folder you’ve specified.

That solved the problem for me – and hopefully, it’ll help someone else.

Last edited by ia278 (2019-03-21 14:31:49)

Offline

#66 2019-02-08 16:03:05

BryanA.
Member
From: Maryland, USA
Registered: 2007-08-12
Posts: 101

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

ia278 wrote #315332:

Solved.

The plugin instructions ask you to create a directory for JavaScript, and then ensure that PHP can write to it…

  • check your preferences to make sure it now appears,
  • save your JavaScript again, to create a copy in the folder you’ve specified.

That solved the problem for me – and hopefully, it’ll help someone else.

Definitely did help. Your image 149 vanished from your link pretty recently but this type of Inserting Rows is pretty daunting for me. Well done, you! Thanks!


Voice Actor – starting up a site for that good book stuff.

Offline

#67 2019-02-12 12:45:02

ia278
Member
From: UK
Registered: 2018-11-07
Posts: 17
Website

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

BryanA. wrote #316512:

Definitely did help. Your image 149 vanished from your link pretty recently but this type of Inserting Rows is pretty daunting for me. Well done, you! Thanks!

No problem, and thanks for the heads-up regarding the link – should be fixed now!

If you’re on 4.7.2, JavaScript forms are now built into the core. I had a bit of trouble getting it working in the beginning, but’s it’s a massive improvement on this plugin! Here’s a link to the thread. :-)

Offline

Board footer

Powered by FluxBB