On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I'm coming back with a fundamental question I never been able to solve:

    Did someone succeed in implementing templates functionality for Tiny (4.3.2 Revo).
    The plugin is present in the component/tinymce folder.
    Adding it to the plugin list + adding'template' to button list did the job to activate a popup where you're supposed to pick up a template (html chunks).
    Unfortunately this list is empty and I did not find where I have to store html files for those templates, neither if/how to setup this.

    However in tiny documentation they talk about ' template_external_list_url' : JavaScript file containing an array of template files. This can be a backend page such as a PHP page.

    Well... how this could be achieved in Revo ?

    There's a template.list.php file in the component/tinymce folder :
    <?php
    /**
     * @package tinymce
     */
    require dirname(__FILE__).'/connector.php';
    
    $templates = $modx->tinymce->getTemplateList();
    
    echo 'var tinyMCETemplateList = '.$modx->toJSON($templates).';';
    die();
    


    Any clues ?

    thank you

    EDIT:
    I forgot to precise:
    in system parameter there's too a tiny.template_list parameter where you have to enter the list of templates (Nameof TPL:path:description, other one, etc...
    This make a list og file to be selectable in the Template popup.
    This seams to work BUT the resulting code is NOT the one in the html file.
    (for instance a 2 columns chunk like this :
    <div>
    <div class="col col50">
    col1
    </div>
    <div class="col col50">
    col2
    </div>
    </div>

    wich is ok in the popup preview, is immediatly corrupted when inserted and becomes :
    <div></div>
    [ed. note: elz064 last edited this post 7 years, 3 months ago.]
    • To add a template you have to

      1. add your template as a html file to the folder assets/templates

      2. go to the second page of the TinyMCE System Settings, you'll find a Setting called Template List and info on the format to add the templates (name:URL:description. For example, MyTemp:assets/templates/mytemp.html:My very own template)

      Hope that helps!

      I'm actually still trying to wrap my head around how to use these templates - I want to add a chunk with TVs inside and I can't figure out where these TVs would appear for the user/editor to add content to them. If you have any ideas on that I'd be glad to hear them.
      :)

      Ricarda
      • hmm.. yes thank you, but ...that's what I was saying too.

        I actually got the tpl list displaying the html files I put into a speciific folder.
        BUT (read back my previous EDIT, this html as ok in the preview, is immediatly corrupted once inserted in the content (before saving the page).

        • I know this post is old, but I am struggling with the same issue. Wondering if you have ever found a solution?

          My templates preview perfectly, but once interested into the content box they have their content stripped, so they are just empty tags. Which is all the more confusing since my usual problem with tinymce is its aggressive stripping of empty tags.
            Lucy Iannotti
            Following Sea design & development
            http://www.following-sea.com
            New Bedford, MA
          • Yes this really a pain.
            Looks like this odd issues does not have many interest for Modx team.

            When this will be be taken in count and finally solve? it's a pity now. Modx is not ONLY a plaform for complex dev, but should be use basicaly too with such useful basic features...

            • I do hope this is on tracker, as many issues posted on forum will get lost and not all issues on forum will be seen by the MODX team. Also fundamentally this isn't good practise to write actual html into the content area. Add to Issue Tracker if not already done so and paste a link to it here.
              • It is on the tracker, or at least what I think is the tracker... here:
                https://github.com/splittingred/TinyMCE/issues/89
                  Lucy Iannotti
                  Following Sea design & development
                  http://www.following-sea.com
                  New Bedford, MA
                • Quote from: easylancer at Sep 13, 2013, 04:48 PM
                  I do hope this is on tracker, as many issues posted on forum will get lost and not all issues on forum will be seen by the MODX team. Also fundamentally this isn't good practice to write actual html into the content area. Add to Issue Tracker if not already done so and paste a link to it here.

                  I do not know what's fundamentally a good practise, but for years I always visited the modx forum and I do not feel very concerned by github.
                  May be I should, I don't know. From my point of view, modx help is fundamentally forum centric.

                  This issue has been discussed for YEARS in many threads and by a lot of modxers.
                  Writing actual html into a content area is what it should be. Asking to the RTE to output consistent and useful content, whatever it could be, if _correct or valid_.

                  The extremly useful fetature of html template "chunk" of TinyMCE is fully part of this RTE, but still not correctly supported / integrated into Revo for now classic html5 tags.
                  I think you 'll agree it is much more a good practice to let output in a content area nice figure/figcaption pre built blocks than letting lambda people paste f%%$g images in a crappy way. (for example).
                  Also, to be consistent with nowdays css framework, it's highly recommended to use html template in RTE.
                  Not talking about other media.
                  Once again TVs and predetermined sections of a page are NOT theonly or good way in many cases.

                  It's good for code guru to see things from a final user point of view, and as I said before, modx is not only a developpement dedicated plat-form, it's also a CMS that should give to users all features that can be useful.
                  • Agreed! But besides not supporting HTML5 tags, the TinyMCE Template plugin does not appear to be working AT ALL. If anyone out there has a working example, please share your specs.

                      Lucy Iannotti
                      Following Sea design & development
                      http://www.following-sea.com
                      New Bedford, MA
                    • Quote from: lucy at Sep 12, 2013, 07:21 PM
                      I know this post is old, but I am struggling with the same issue. Wondering if you have ever found a solution?

                      My templates preview perfectly, but once interested into the content box they have their content stripped, so they are just empty tags. Which is all the more confusing since my usual problem with tinymce is its aggressive stripping of empty tags.

                      This is slightly related...I was having the same problem with templates looking fine in the preview, but stripping contained HTML once they were inserted (all HTML, not just HTML5).

                      I fiddled with a bunch of things, and the one that seemed to fix the problem for me was adjusting the tiny.editor_theme setting in the system settings to have a value of "advanced". This did some magic that allowed my TinyMCE templates to work as expected.