We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11180
    • 10 Posts
    I started Implementing MODx as the backend of all websites since last year.. Absolutely Brilliant !

    I can have multiple Content Areas which are editable through the edit resource button within my templates, however I have now come up against something that i think must be possible but can’t seem to find what I am looking for!

    I have a that has 3 regions Left Column, and 2 regions one on top of the other to the right. I want to keep the 2 on the right as editable within all pages but would like the content in the Left column to stay the same on all pages but editable from any?

    Any ideas on this would be great!
      • 4172
      • 5,888 Posts
      perhaps you are looking for something like that?

      http://bruno.tattoocms.de/96.html

      in this example, there are blocks, which have the same content on different pages speisen-pool, lunch, dinner.
      they are all inline editable and inline sortable in different orders on each page, but the block-content is always the same.
      each block is one modx-resource and listet as you know it from Ditto, but with bloX.

      above there is a block which is different on each page= [*content*]. this block is configured that you can edit in the control-center-tab ’TV’ , if you are logged in.

      this is done with bloX/Xedit. (still in developement)

      ok, here is an account for short time: guest/guestpasword

        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 4172
        • 5,888 Posts
        And here is a simple way for editing a chunk in your content-editarea:

        create a plugin and check the events OnDocFormRender and OnBeforeDocFormSave :

        <?php//remove this line - its only for styling in this forum!!!
        
        $chunkname='editchunk';//edit this line for your chunk you want to edit
        $e = &$modx->Event;
        
        switch($e->name) {
          case 'OnDocFormRender':
          echo '<div class="sectionHeader">Chunks</div>
        <div class="sectionBody chunks">
        	<table cellspacing="0" cellpadding="3" border="0" width="96%" style="position: relative;">
        		<tbody><tr style="height: 24px;"><td align="left" width="150" valign="top"><span class="warning">edit chunk</span>
        			<br/><span class="comment"/></td>
        			<td valign="top" style="position: relative;">
        			<textarea style="width: 100%;" onchange="documentDirty=true;" rows="15" cols="40" name="chunkcontent" id="chunkcontent"/>'.$modx->getChunk($chunkname).'</textarea>
        		</td></tr></tbody></table>
        </div>';
            break;
          case 'OnBeforeDocFormSave':
        if (isset($_POST['chunkcontent'])){   $modx->db->update(array('snippet'=>$modx->db->escape($_POST['chunkcontent'])),$modx->getFullTablename('site_htmlsnippets'),'name="'.$chunkname.'"');
        }    
          default:
            return;
            break;
        }
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 20413
          • 2,877 Posts
          Sweet plugin! cool
            @hawproductions | http://mrhaw.com/

            Infograph: MODX Advanced Install in 7 steps:
            http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

            Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
            http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
            • 11180
            • 10 Posts
            Thankyou for the replies! I have been away for a couple of days but will check this out today!!
              • 11180
              • 10 Posts
              Excellent have this working..

              Just one thing the text is not formattable, is there a way to enable the text editor so i can neaten the text?

              Thanks
                • 11180
                • 10 Posts
                Quote from: gr00vytunes at Mar 12, 2010, 05:57 AM

                Excellent have this working..

                Just one thing the text is not formattable, is there a way to enable the text editor so i can neaten the text?

                Thanks

                Ok I see I can use TinyMCE within the Chunk Element itself and make the text look nice and neat however, I would like it if this could be done through the edit resource button for users that are not likely to have access to the modx management console and will be content editors only!

                Thanks
                  • 4172
                  • 5,888 Posts
                  with this modified plugin you should have tinymce on your chunkcontent-field on your document-form and you can edit your chunk with QM+

                  <?php//remove this line - its only for styling in this forum!!!
                  
                  $chunkname = 'editchunk';//edit this line for your chunk you want to edit
                  $e = & $modx->Event;
                  
                  switch($e->name)
                  {
                      case 'OnDocFormRender':
                          echo '<div class="sectionHeader">Chunks</div>
                  <div class="sectionBody chunks">
                  	<table cellspacing="0" cellpadding="3" border="0" width="96%" style="position: relative;">
                  		<tbody><tr style="height: 24px;"><td align="left" width="150" valign="top"><span class="warning">edit chunk</span>
                  			<br/><span class="comment"/></td>
                  			<td valign="top" style="position: relative;">
                  			<textarea style="width: 100%;" onchange="documentDirty=true;" rows="15" cols="40" name="chunkcontent" id="chunkcontent"/>'.$modx->getChunk($chunkname).'</textarea>
                  		</td></tr></tbody></table>
                  </div>';
                          global $replace_richtexteditor;
                          if (is_array($replace_richtexteditor))
                          {
                              $replace_richtexteditor = array_merge($replace_richtexteditor, array (
                              "chunkcontent",
                              ));
                          } else
                          {
                              $replace_richtexteditor = array (
                              "chunkcontent",
                              );
                          }
                      break;
                      case 'OnBeforeDocFormSave':
                          if ( isset ($_POST['chunkcontent']))
                          {
                              $modx->db->update( array ('snippet'=>$modx->db->escape($_POST['chunkcontent'])), $modx->getFullTablename('site_htmlsnippets'), 'name="'.$chunkname.'"');
                          }
                          break;
                      case 'OnRichTextEditorInit':
                          //$modx->logEvent(1, 1, print_r($params, true));
                  
                          break;
                      default:
                          return;
                          break;
                  }
                  
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 11180
                    • 10 Posts
                    That is perfect! Thanks Bruno, much appreciated grin