We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18397
    • 3,250 Posts
    NEW VERSION: 3.1 fixes some minor typos and is ready for x9.1
    ANOTHER UPDATE: Removed the <? accidentally left in the posted file. If you already have a copy of v3 just remove the first line (<?) and it should work fine.
    UPDATE: New version with pagination support!


    Please give the following snippet a try to make sure there are no bugs or typo’s.

    Make sure to give the debug and pagination modes a test.
      • 25663 MODX Staff
      • 12,272 Posts
      This is great... wonderful job Mark!

      Here’s what I’d like to be able to do, based on a very early idea that Raymond brought to the table for multiple templates in a chunk-template:

      Use the HR insertion tool in the RTE for the splitter function. The problem is that FCK really splits the text at that point:
      </p>
      <hr width="100%" size="2" />
      <p>

      Not to mention the crazy formatting on the HR, but that’s another issue... and this is after having set it to turn off source formatting (a change we should definitely make). Before then it output this:

      <span> </span></p>
      <hr width="100%" size="2" />
      <p><span></span>

      Ummm... which makes sense to me too.. huh

      Is there any way to add a custom button to FCK for this purpose, and all it does is inserts a simple, semantic <hr /> without all the fancy wrangling? Jeff?

      Thanks, and again, wonderful job!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 18397
        • 3,250 Posts
        It is definitely possible, just a question of learning the API and putting it to use.

        I think there actually is an example that does something similar on the FCKeditor site.
          • 25663 MODX Staff
          • 12,272 Posts
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 25663 MODX Staff
            • 12,272 Posts
            I tried and no go:

            From custom_config.js and config.js:
            ...
            FCKConfig.FormatSource		= false ;
            ...
            FCKConfig.Plugins.Add( 'Splitter' ) ;
            ...
            FCKConfig.ToolbarSets["standard"] = [
            	['Source','-','Preview','-','Templates'],
            	['Cut','Copy','Paste','PasteText','PasteWord'],
            	['Undo','Redo','-','Find','Replace','-','RemoveFormat'],
            	['Bold','Italic','Underline'],
            	['OrderedList','UnorderedList','-','Outdent','Indent'],
            	['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
            	['Link','Anchor','Splitter'],
            	['Image','Flash','Table','Rule','SpecialChar'],
            	['Style'],['FontFormat'],['FontName'],['FontSize'],
            	['TextColor','BGColor']
            ];


            From editor/plugins/Splitter:
            //Begin Code 
            var FCKSplitter = function(name)  
            {  
            this.Name = name;  
            }  
            
            FCKSplitter.prototype.Execute = function()  
            {  
            if(document.all)  
            {  
            mySelection = FCK.EditorDocument.selection 
            }  
            else  
            {  
            mySelection = FCK.EditorWindow.getSelection() 
            }  
            myTextRange= mySelection.createRange() 
            myText = myTextRange.text  
            FCK.InsertHtml(myText+"<hr />") 
            myTextRange.select() 
            }  
            
            // manage the plugins' button behavior  
            FCKSplitter.prototype.GetState = function()  
            {  
            return FCK_TRISTATE_OFF;  
            }  
            
            FCKCommands.RegisterCommand( 'Splitter', new FCKSplitter('Splitter')) ;  
            
            // Create the toolbar button. 
            var oEmphasisItem = new FCKToolbarButton( 'Splitter', "Splitter", null, null, false, true ) ; 
            oEmphasisItem.IconPath = FCKConfig.PluginsPath + 'Splitter/hr.gif' ; 
            FCKToolbarItems.RegisterItem( 'Splitter', oSplitterItem ) ;  
            
            //End Code

              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 18397
              • 3,250 Posts
              Thanks for the great find!

              I’ll take a look at this tommorrow.
                • 33337
                • 3,975 Posts
                [off-topic]

                Is there a difference between NewsListing and NewsArchive snippet ?

                If yes, what is it ? smiley

                regards,

                zi
                  Zaigham R - MODX Professional | Skype | Email | Twitter

                  Digging the interwebs for #MODX gems and bringing it to you. modx.link
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Use the HR insertion tool in the RTE for the splitter function.

                  But what if somebody really wants to have an <hr /> in their document?

                  Wouldn’t it be better to simply copy/paste the section of code that handles the <hr> and then modify it to be "Splitter" and generate the <!-- splitter --> comment?
                    Studying MODX in the desert - http://sottwell.com
                    Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                    Join the Slack Community - http://modx.org
                    • 25663 MODX Staff
                    • 12,272 Posts
                    Sure, that would work.
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 18397
                      • 3,250 Posts
                      Archive has pagination