We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20413
    • 2,877 Posts
    I got inspired from this article: http://www.yongfook.com/items/view/81/10-dirty-little-web-development-tricks (404 now)
    to ask you MODx-hackers what you rank as your best tricks!

    //This thread proves that MODx Community is the #1 Community on the web. 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
      • 7231
      • 4,205 Posts
      My secret is that I don’t really use modx, I use Joomla and love it shocked

      All of my ’not so’ secrets are posted in this forum..well actually here is a recommendation: read the forum everyday, it is incredible how much you can pick up by seeing what is causing problems and how they are resolved, even if the problem may not be related to your current projects. And bookmark (and organize) the posts that you think may be interesting because it may take some effort to find them again later.

      ps: Ok, I really DO use modx tongue

        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 29774
        • 386 Posts
        I’ve been meaning to share this dirty hack for a while: how to use eform to attach a CSV file to an email containing the form data.

        1. Create a snippet called ’eFormEvents’; this will contain a function that is attached to the eform event eformOnBeforeMailSent.

        This is an example of what I have, which grabs my form fields, formats the csv data string, inserts into a new field called csv, and also creates a field called registrationid containing a unique reference to the submitted data (so we can give the csv file a unique name):
        // attach form data as a CSV file
        function attachCSV(&$fields){
        
        	$cr = "\n";
        	
        	$csv = '"Title","First name","Last name","Email","Telephone","Mobile","Address 1","Address 2","City","County","Postcode", "Worktype","Day rate","Functional Expertise","Industry Expertise","Skills","Job Reference","How did you hear?","Privacy policy"'.$cr;
        	$csv .= 
        	 csv($fields['title']).','
        	.csv($fields['firstname']).','
        	.csv($fields['lastname']).','
        	.csv($fields['email']).','
        	.csv($fields['telephone']).','
        	.csv($fields['mobile']).','
        	.csv($fields['address1']).','
        	.csv($fields['address2']).','
        	.csv($fields['city']).','
        	.csv($fields['county']).','
        	.csv($fields['postcode']).','
        	.csv($fields['worktype']).','
        	.csv($fields['dayrate'].' per '.$fields['rateperiod']).','
        	.csv(implode(" | ", $fields['functionalexpertise'])).','
        	.csv(implode(" | ", $fields['industryexpertise'])).','
        	.csv(implode(" | ", $fields['skills'])).','
        	.csv($fields['reference']).','
        	.csv($fields['howhear']).','
        	.csv($fields['privacy']).$cr;
        	
        	$registrationid .= strtoupper(substr($fields['firstname'],0,1)).strtoupper(substr($fields['lastname'],0,1));
        	$registrationid .= date('ymdHi');
        	
        	// set fields
        	$fields['csv'] = $csv;
        	$fields['registrationid'] = $registrationid;
        	
        	return true;
        }
        
        function csv($value) {
        	if (strstr($value, ",") || strstr($value, "\n") || strstr($value, "\r")) {
        		return "\"" . str_replace("\"", "\"\"", $value) . "\"";
        	} else {
        		return "\"".$value."\"";
        	}
        }
        

        2. Add the function to your eform snippet call, eg:
        [!eFormEvents!]
        [!eForm? &formid=`myFormId` &to=`....` &tpl=`....` &report=`....` &subject=`....` &eformOnBeforeMailSent=`attachCSV` !]
        

        3. Add this to eform.inc.php (version 1.4.4.5) at around line 473:
        // attach csv
        if ($fields['csv'] !='') {
            $mail->AddStringAttachment($fields['csv'], 'CSV_'.$fields['registrationid'].'.csv');
        }
        


        Done. Glad I got that off my chest...
          Snippets: GoogleMap | FileDetails | Related Plugin: SSL
        • Great topic btw. smiley
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 28215
            • 4,149 Posts
            The one I continually use on nearly every site:

            http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks
              shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
              • 7231
              • 4,205 Posts
              Quote from: splittingred at Dec 03, 2008, 04:43 PM

              The one I continually use on nearly every site:

              http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks
              That is a great tip. I did not check that out until recently and it is really a nice feature, I can’t believe it took me so long to give it a try.
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don't know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 27330
                • 884 Posts
                  • 20413
                  • 2,877 Posts
                  When I log in here its like coming to my favourite store, filling my shopping cart as much as can fit in it.
                  Then the cashier tells me its all free and wrap my stuff in and even helps me carry it out.

                  Then they say come back soon again! kiss
                    @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
                    • 29774
                    • 386 Posts
                    Another one: how to add a template button to the TinyMCE WYSIWYG editor. This allows you to give your content editors a library of ready made html ’templates’ that they can use insert into the content of the page. This can be very handy, if, say, you need a arbitary right aligned images and caption that could appear once or multiple times within the page content.

                    Add templates as html files to /assets/templates/, eg images-row-1-left.html might look like this:
                    <table align="left" width="186" border="0" cellspacing="0" cellpadding="0" summary="" class="figure left">
                      <tr valign="top">
                        <td><img src="/assets/images/blank.gif" alt="" width="162" height="135" /></td>
                      </tr>
                      <tr valign="top">
                        <td><h4>Caption</h4><p>Description</p></td>
                      </tr>
                    </table>
                    


                    Then add a templates list to /assets/plugins/tinymce212/tinymce.functions.php at around line 202

                    $tinymceInit .= "		  template_templates : [
                    			{ title : \"Images - single\", src : \"/assets/templates/images-row-1.html\", description : \"Add single image + caption \" },
                    			{ title : \"Images - single - aligned left\", src : \"/assets/templates/images-row-1-left.html\", description : \"Add single image, aligned left + caption \" },
                    			{ title : \"Images - single - aligned right\", src : \"/assets/templates/images-row-1-right.html\", description : \"Add single image, aligned right + caption \" },
                    			{ title : \"Images - 2 in a row\", src : \"/assets/templates/images-row-2.html\", description : \"Add 2 images in a row + caption\" },
                    			{ title : \"Images - 3 in a row\", src : \"/assets/templates/images-row-3.html\", description : \"Add 3 images in a row + caption\" },
                    			{ title : \"Images - 4 in a row\", src : \"/assets/templates/images-row-4.html\", description : \"Add 4 images in a row + caption\" }
                    		]".",\n";
                    


                    Finally, add ’template’ to the TinyMCE custom button configuration string in the Manager under Tools > Configuration > Interface & features, eg on button row 2:
                    bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,formatselect,separator,template,table,separator,help
                    
                      Snippets: GoogleMap | FileDetails | Related Plugin: SSL
                      • 7231
                      • 4,205 Posts
                      @therebechips: your tips deserve to be in the wiki for sure. I am afraid that these pearls will be hidden in this thread. grin
                        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                        Something is happening here, but you don&#39;t know what it is.
                        Do you, Mr. Jones? - [bob dylan]