How to show a setting in a .json file

  • Hello,

    I would like to add a certain information, entred in the ACP, in my .json file.

    For exemple, i have a custom "manifest.json" file :

    Code
    {
      "name": "My text"
    }

    If want "My text" to be the entered text in my ACP, for example : Page Title

    I tried this, but it didn't work :

    {@xxxxxxxxxx}

    WCF.Language.get('xxxxxxxx')

    Do you know if it's possible and if yes, how to achieve this please ? :)

    Thanks

  • Maybe you should implement an AbstractAction. Here is an (untested, on-the-fly written) example to get the title and the teaser from an article:

    Please consider, that everyone have access to your information. If you are using more "private" data, set $loginRequired to true and adjust $neededPermissions. In my example $neededPermissions could be:

    $neededPermissions = ['user.article.canReadArticle']

    I hope this helps.

  • Maybe you should implement an AbstractAction. Here is an (untested, on-the-fly written) example to get the title and the teaser from an article:

    Please consider, that everyone have access to your information. If you are using more "private" data, set $loginRequired to true and adjust $neededPermissions. In my example $neededPermissions could be:

    $neededPermissions = ['user.article.canReadArticle']

    I hope this helps.

    Great, i'll try this, in fact i only need to get a value from an input in the ACP and add it a "manifest.json" file, so it should be more simple..

    So your code will create a .json file ? How it is called ?

    Thank you :)

  • Ok,

    in fact, it's for a custom plugin i am making for "OneSignal" (https://onesignal.com/)

    In the ACP, there will be an input to write the "application name".

    To make OneSignal work, we must send some files in our FTP, one of them is a "manifest.json" file which contain this :

    Code
    {
      "name": "APP-NAME",
      "short_name": "APP-NAME",
      "start_url": "/",
      "display": "standalone",
      "gcm_sender_id": "482941778795",
      "DO_NOT_CHANGE_GCM_SENDER_ID": "Do not change the GCM Sender ID"
    }

    In this file, the "

  • From

    manifest.json

    • This file can be served from anywhere (from any origin, not just your site's) and any subfolder and the file can be named however you would like. Just be sure to include the file with the correct path and filename. This file only affects Chrome; Safari and Firefox do not use a manifest.json for push notifications.

    So your template code should look like this:

    Please note, that you have to include your APPID in this template.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!