Resource files are added to the page header and can be added to the back-end as well as the front-end.
Example code
Enable JavaScript resource file in back-end and/or front-end
Result
2 Replies to “JavaScript Files”
I’m trying to re-create a javascript resource file in a WordPress from a classic ASP site, that consists of 675 lines of array data – creating 2 arrays needed on some of my new pages. Error at saving the code is “ERROR: Insert failed” – not sure where to look, or how to display the SQL code that is failing, so I could figure out why… I’ve tried adding a semicolon after each line adding values, and have tried taking out both ‘comments’ – still the same error.
Snippets of the two array variables (the file contains nothing else, just these two variables creation and lines filling the arrays, as follows):
var ints = new Array(663); //0-based storage
ints[1]={id:1,lat:45.6734810,lng:-122.6909409,ew:0,ns:2,ewName:’Bernie Dr.’,nsName:’Fruit Valley Rd.’}
ints[5]={id:5,lat:45.7254906,lng:-122.7060089,ew:55,ns:2,ewName:’Bliss Rd.’,nsName:’NW 36th Av.’}
ints[6]={id:6,lat:45.6183319,lng:-122.6752167,ew:0,ns:4,ewName:’ ** Stateline **’,nsName:’SR – 5′}
…660 more rows
var arts = new Array(100); //0-based storage
arts[1]={id:1}
arts[2]={id:2}
…10 more rows
The issue occured because the code exceeded the maximum column length for the code column. The column data type is text, which allows to store 64Kb. Here is the alter table statement to increase the maximum column length:
alter table wp_code_manager modify code mediumtext
Or if you still need more:
alter table wp_code_manager modify code longtext
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok
I’m trying to re-create a javascript resource file in a WordPress from a classic ASP site, that consists of 675 lines of array data – creating 2 arrays needed on some of my new pages. Error at saving the code is “ERROR: Insert failed” – not sure where to look, or how to display the SQL code that is failing, so I could figure out why… I’ve tried adding a semicolon after each line adding values, and have tried taking out both ‘comments’ – still the same error.
Snippets of the two array variables (the file contains nothing else, just these two variables creation and lines filling the arrays, as follows):
var ints = new Array(663); //0-based storage
ints[1]={id:1,lat:45.6734810,lng:-122.6909409,ew:0,ns:2,ewName:’Bernie Dr.’,nsName:’Fruit Valley Rd.’}
ints[5]={id:5,lat:45.7254906,lng:-122.7060089,ew:55,ns:2,ewName:’Bliss Rd.’,nsName:’NW 36th Av.’}
ints[6]={id:6,lat:45.6183319,lng:-122.6752167,ew:0,ns:4,ewName:’ ** Stateline **’,nsName:’SR – 5′}
…660 more rows
var arts = new Array(100); //0-based storage
arts[1]={id:1}
arts[2]={id:2}
…10 more rows
The issue occured because the code exceeded the maximum column length for the code column. The column data type is text, which allows to store 64Kb. Here is the alter table statement to increase the maximum column length:
alter table wp_code_manager modify code mediumtext
Or if you still need more:
alter table wp_code_manager modify code longtext
Perfect, thank you, Peter