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: 6,878
Website

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.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

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

ia278
New Member
From: UK
Registered: 2018-11-07
Posts: 4
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: 6,878
Website

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

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


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

Offline

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

ia278
New Member
From: UK
Registered: 2018-11-07
Posts: 4
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 Today 03:55:05

ia278
New Member
From: UK
Registered: 2018-11-07
Posts: 4
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.

The row should have the following properties and values (and look like this when completed);

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 ordered 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.

Offline

Board footer

Powered by FluxBB