We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10489
    • 93 Posts
    Hi all,

    I know this has been spoken about here: http://modxcms.com/forums/index.php?topic=41005.0
    but i can’t for the life of me get it working.
    In fact i even tried this: http://modxcms.com/forums/index.php?topic=30069.0 and this: http://modxcms.com/forums/index.php/topic,31097.msg188847.html#msg188847

    I am using modx-1.0.4
    When i click on ’Insert pre-defined template content’ there are no templates listed
    Can some assist?

    thanks
    Garth
      • 15953
      • 123 Posts
      I spent the whole day reviewing those past forum messages. The originator of the idea was creating resources in MODx CMS Manager, which are stored in the database, not to files. Others were talking about crating files. Some were mixing the two. It was all very confusing, but turned out to be simple:

      In System Configuration, Interface and Features, TinyMCE needs to have “template” added to Custom Plugins and Buttons.
      In the TinyMCE plugin custom parameters field ( Manage Elements / Plugins: under configuration tab for TinyMCE Rich Text Editor plugin) add:

      CODE:
      template_external_list_url: http://gsyha.org/assets/templates/templates.js

      (It’s important to use this absolute path, or at least it was for me.)

      Create a new js file "templates.js". Enter:

      CODE:
      // JavaScript Document
      var tinyMCETemplateList = new Array(
      // Name, URL
      ["Scrolling Credits", "/templates/credits.html"],
      ["Test", "/templates/test.html"]
      );

      These relative paths work because the /templates folder is under /assets, which is the base path.
      Credits.html and test.html are the two template files. Credits.html contains “{{credits}}” as it’s only content, which gets inserted into the document being edited by TinyMCE.

      It didn’t seem necessary to me to have a script call a chunk when I could just add {{chunk_name}} in the html file.
        • 10489
        • 93 Posts
        Thank you,

        Will try this out and let you know