0

My JSON:

{
"label": "Menu Position",
"name": "topmenualign",
"type": "select",
"values":["left", "right", "center"],
"default": "right"
},

My JS:

var ipDesignOptions = {
  'topmenualign': function (value){
    $('nav ul.level1>li').css('text-align', value);
  }
};

Generated style:

text-align:**"value"**;

Should be:

text-align:**value**;

How to escape double quotes? I've tried few ways described in Stack Overflow but no luck.

Update:

This is for impress pages theme CMS

I am using one of an examples to build options for theme design.

There is 4 files that I need to play with.

config.less --> is to define specific variable e.g. @topmenualign: right;

style.less --> to define data with result e.g. nav {text-align:@topmenualign;}

theme.json --> to specify options

e.g. {

"label": "Menu Position",

"name": "topmenualign",

"type": "select",

"values":["left", "right", "center"],

"default": "right"

}

options.js ...

var ipDesignOptions = {

  'topmenualign': function (value){

    $('nav').css('text-align', value);

  }

};

this combination allows theme user adjust design visually and updates main css file "theme.css" with value

nav {text-align:"value";}

Everything is straight forward and works perfect for numeric value e.g. padding:'@value'px, but words come out with double quotes and I don't understand where and how I should escape them.

I will check if I can post it on fiddle later, but don't think I would be able to implement working example - need database I think. p.s. my reference https://github.com/algimantas/theme-LessSkeleton/


I do not want to modify any core files and would like to come up with solution within theme files if this at all possible. How could I pass it to php? I suppose I could write specific css within php page using php variables.

please do not edit "impresspages" tag, as it might attracts people who is familiar with the system.

SergeDirect
  • 2,019
  • 15
  • 20

0 Answers0