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

    I have been reading this thread (#9) (http://modxcms.com/forums/index.php/topic,31097.0.html) about adding a template option to Tinymce in order to have content repeat in the content area (i want an image to the left at a set width with text floated to the right in set width) which sounds incredibly useful.
    I have got as far as adding the template option to the tinymce options but can’t see my template in the drop down options.
    I have added the following to tinymce.functions.php at line 202 as stated in the aforementioned thread:

    	$tinymceInit .= "		  template_templates : [
    			{ title : \"Images - single\", src : \"/assets/templates/left-right.html\", description : \"Add single image + caption \" },
    		]".",\n";


    My html template simply contains a couple of basic div tags..no head or body tags..is this correct?
    Is the above code pasted into the correct place?
    The entire code block with my addition looks like this (my addition in red):
    function build_tiny_callback($params)
    	{
    		$ph['cmsurl']  = MODX_BASE_URL . 'manager/media/browser/mcpuk/browser.php?Connector=';
    		$ph['cmsurl'] .= MODX_BASE_URL . 'manager/media/browser/mcpuk/connectors/php/connector.php&ServerPath=';
    		[color=red]$tinymceInit .= "		  template_templates : [
    			{ title : \"Images - single\", src : \"../assets/templates/left-right.html\", description : \"Add single image + caption \" },
    		]".",\n";[/color]
    		$ph['cmsurl'] .= MODX_BASE_URL . '&editor=tinymce&editorpath=' . $params['mce_url'];
    		$modx_fb = file_get_contents($params['mce_path'] . 'js/modx_fb.js.inc');
    		
    		foreach($ph as $name => $value)
    		{
    			$name = '[+' . $name . '+]';
    			$modx_fb = str_replace($name, $value, $modx_fb);
    		}
    		return $modx_fb;
    	}
    


    Can anyone help with this as it would be such a useful addition?

    Thanks

    J
      www.9thwave.co.uk
         WEB | DESIGN | PRINT
      • 27517
      • 2 Posts
      Hi there,

      I’m having the exact same issue. Did you ever find a solution to this?

      Thanks!
        • 36549
        • 572 Posts
        Hi

        No unfortunately not. I went with a table based solution in this instance and would simply opt for a ditto solution in most other similar situations.
          www.9thwave.co.uk
             WEB | DESIGN | PRINT
          • 36442
          • 97 Posts
          I’ve managed to add templates to TinyMCE, but not the way described in that topic.
          Are you using Evo or Revo?
            • 36549
            • 572 Posts
            I used Evo with that site.
              www.9thwave.co.uk
                 WEB | DESIGN | PRINT
              • 36442
              • 97 Posts
              Do you still need a solution?
                • 36549
                • 572 Posts
                Not for that particular site but if you find a solution it would be great to hear about it as i’m sure it could be utilized on future projects.
                  www.9thwave.co.uk
                     WEB | DESIGN | PRINT
                  • 27517
                  • 2 Posts
                  I actually got it working for me using the advice/.zip in this thread:

                  http://modxcms.com/forums/index.php/topic,16382.msg104435.html#msg104435

                  Very pleased!