Dynamic API keys and directories

If you host many websites using one CMS and one database, you probably want to configure N1ED especially for this case. This is an optional step required only if you have independent websites hosted on one server inside one CMS.

What means "an independent website"? This is when you need to isolate editor configurations between websites, to let users on different websites have their own gallery of custom blocks and templates and change preferences of their editor not touching all other websites.

Independent API keys

To implement this you need to tell N1ED on which website it is loaded on initialization. When you initialize it, you pass the API key. Depending on your integration you do it differently:

  • TinyMCE and CKEditor plugins: you pass apiKey parameter to the editor.
  • JS snippet: you include the API key into the URL of JavaScript file you load.
  • etc.

So first of all you need to create a number of isolated API keys: one per independent website. As far as each API key of N1ED is a reference to some cloud configuration, your editor will load different preferences according to the API key you pass.

Inject retrieved keys into initialization parameters of N1ED on startup and a new configuration will apply.

Do not forget to pass this API key to configuration widget too.

In the single website installation the best place to store N1ED API key and a token was some table with global variables or preferences. When you have a multisite installation, please use user profiles for this purpose.

Independent file storage

Each website has its own directory where users upload files and where they link to when they want to insert some image into their content. Do not use the dashboard to configure all file manager paths, you probably can do it programmatically using the API of N1ED.

You need to do add some user-related info to client-side parameters:

  • Flmngr.urlFileManager
  • Flmngr.urlFiles

and to server-side parameters, for example in PHP:

  • dirFiles
  • dirCache
  • dirTmp

Please read more about them all in the file manager installation step you've already passed.