We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16278
    • 928 Posts
    Yes, misnamed parameters are generally just ignored. I haven't poked around in 1.0.12's Ditto code, but perhaps you could try a different name for the runSnippet parameters array - you may be clashing with an internal variable called $params. (Guesswork).
    :) KP
    • @EVAL return $modx->runSnippet('Ditto', array('parents'=>32, 'tpl'=>'box-testimonial-Tpl', 'orderBy'=>'pagetitle DESC'));

      could maybe remove that issue.

      But I would use Quill for that.
        • 10525
        • 247 Posts
        OK, finally getting somewhere.

        kp52, I tried changing the params var from $params to $prams: no improvement.

        Jako, I tried your suggestion of moving the array into runSnippet(): behaviour stayed the same. (I'll get back to you re Quill).

        I tested Ditto by running the same Ditto call directly from the page content, as:
        [[Ditto? &startID=`32` &tpl=`box-testimonial-Tpl` &orderBy=`pagetitle DESC`]]

        This generated the exact same output as is displayed in the error popup:
        Office==122||Broadband Jargon==117||Special Offer==114||Mobile Broadband ==109||BIG Giveaway==106||Solo PDF's==105||Sharer PDF's==104||Broadband PDF's==103||Maintenance Docs==102||VPN FAQ's ==93||SHDS Docs==90||Flow Docs==89||Install==66||Versatility Docs==65||Mobile- Ts & Cs==64||Recruitment==63||Guide==62||nclusive PDF's==61|Plus PDF's==60||Reseller==59||Business==58||Brochure==57||Infinity Docs==56||Clear Documents==55||Inclusive PDFs==54||
        This a list of the correct pages that appear in the TV dropdown (in spite of the error popup).

        I copied and pasted that output into the TV Input Option Values box, in place of the @EVAL call, and the dropdown in the resource edit page is populated correctly, but no error popup!

        So is it @EVAL that causes the problem?

        I tried returning the string from @EVAL, but without Ditto:
        @EVAL return("Office==122||Broadband Jargon==117||Special Offer==114||Mobile Broadband ==109||BIG Giveaway==106||Solo PDF's==105||Sharer PDF's==104||Broadband PDF's==103||Maintenance Docs==102||VPN FAQ's ==93||SHDS Docs==90||Flow Docs==89");

        And all works fine. No error. (Irrespective of the trailing double-pipes(||)).

        So it seems to be an interaction between @EVAL and Ditto that causes the problem...

        (btw forgot to mention that I had mod_security disabled by the hosting company (took neatly a week), and that made no difference to this issue).


          • 16610
          • 634 Posts
          Quote from: Gav at Nov 14, 2013, 12:56 AM
          OK, finally getting somewhere.

          I can confirm this. Exactly the same situation and error. @EVAL with Ditto call produces an error.
            Mikko Lammi, Owner at Maagit
          • Is there an error message in PHP error log?
              • 16610
              • 634 Posts
              Quote from: Jako at Dec 02, 2013, 03:17 PM
              Is there an error message in PHP error log?

              Tested on:

              - PHP 5.4.7
              - PHP 5.2.17

              Error message in MODX log:

              « MODX Parse Error »
              MODX encountered the following error while attempting to parse the requested resource:
              « PHP Parse Error »
              PHP error debug
              ErrorType[num] :	NOTICE[8]
              File :	C:\xampp\htdocs\---\assets\snippets\ditto\snippet.ditto.php
              Line :	1084
              Source :	Snippet
              Basic info
              REQUEST_URI :	/---/manager/index.php?a=27&id=265
              Manager action :	27 - Editing resource
              Referer :	---
              User Agent :	---
              IP :	::1
              Benchmarks
              MySQL :	0.1880 s (11 Requests)
              PHP :	0.5780 s
              Total :	0.7660 s
              Memory :	2.8069915771484 mb
              
              Backtrace
              
              1	include_once()
              manager/index.php on line 301
              2	renderFormElement()
              manager/actions/mutate_content.dynamic.php on line 814
              3	ProcessTVCommand()
              manager/includes/tmplvars.inc.php on line 47
              4	eval()
              manager/includes/tmplvars.commands.inc.php on line 64
              5	DocumentParser->runSnippet()
              manager/includes/tmplvars.commands.inc.php(64) : eval()'d code on line 1
              6	DocumentParser->evalSnippet()
              manager/includes/document.parser.class.inc.php on line 2400
              



                Mikko Lammi, Owner at Maagit
              • Fixed here: https://github.com/Jako/evolution/commit/ac37544df81727be97e9ae25904751f24c089053

                Seems that the ErrorType 'NOTICE' (has to be the caused by checking the not existing variable $outerTpl) only breaks @EVAL bindings and not the normal Ditto call. Or is the same error displayed with a Ditto call on a page without &outerTpl parameter?
                  • 16610
                  • 634 Posts
                  Quote from: Jako at Dec 03, 2013, 07:55 PM
                  Fixed here: https://github.com/Jako/evolution/commit/ac37544df81727be97e9ae25904751f24c089053

                  First, thank you very much your help Jako!

                  I Applied the patch to Ditto resulting a different error:

                  « MODX Parse Error »
                  MODX encountered the following error while attempting to parse the requested resource:
                  « PHP Parse Error »
                  PHP error debug
                  ErrorType[num] :	NOTICE[8]
                  File :	C:\xampp\htdocs\---\assets\snippets\ditto\classes\phx.parser.class.inc.php
                  Line :	19
                  Source :	Snippet
                  Basic info
                  REQUEST_URI :	/---/manager/index.php?a=27&id=265
                  Manager action :	27 - Editing resource
                  Referer :	http://localhost/---/manager/index.php?a=1&f=tree
                  User Agent :	---
                  IP :	::1
                  Benchmarks
                  MySQL :	0.0516 s (23 Requests)
                  PHP :	0.1216 s
                  Total :	0.1732 s
                  Memory :	2.8069915771484 mb
                  
                  Backtrace
                  
                  1	include_once()
                  manager/index.php on line 301
                  2	renderFormElement()
                  manager/actions/mutate_content.dynamic.php on line 814
                  3	ProcessTVCommand()
                  manager/includes/tmplvars.inc.php on line 94
                  4	eval()
                  manager/includes/tmplvars.commands.inc.php on line 64
                  5	DocumentParser->runSnippet()
                  manager/includes/tmplvars.commands.inc.php(64) : eval()'d code on line 1
                  6	DocumentParser->evalSnippet()
                  manager/includes/document.parser.class.inc.php on line 2400
                  


                  Based on that error I tried to run Ditto snippet with param phx=0 resulting a new error:

                  « MODX Parse Error »
                  MODX encountered the following error while attempting to parse the requested resource:
                  « PHP Parse Error »
                  PHP error debug
                  ErrorType[num] :	NOTICE[8]
                  File :	C:\xampp\htdocs\---\manager\includes\document.parser.class.inc.php
                  Line :	2994
                  Source :	Snippet
                  Basic info
                  REQUEST_URI :	/---/manager/index.php?a=27&id=265
                  Manager action :	27 - Editing resource
                  Referer :	http://localhost/---/manager/index.php?a=1&f=tree
                  User Agent :	
                  IP :	::1
                  Benchmarks
                  MySQL :	0.0674 s (23 Requests)
                  PHP :	0.1010 s
                  Total :	0.1684 s
                  Memory :	2.8064651489258 mb
                  
                  Backtrace
                  
                  1	include_once()
                  manager/index.php on line 301
                  2	renderFormElement()
                  manager/actions/mutate_content.dynamic.php on line 814
                  3	ProcessTVCommand()
                  manager/includes/tmplvars.inc.php on line 94
                  4	eval()
                  manager/includes/tmplvars.commands.inc.php on line 64
                  5	DocumentParser->runSnippet()
                  manager/includes/tmplvars.commands.inc.php(64) : eval()'d code on line 1
                  6	DocumentParser->evalSnippet()
                  manager/includes/document.parser.class.inc.php on line 2400
                  
                    Mikko Lammi, Owner at Maagit
                  • Now evalSnippet/evalPlugin respects the 'detection level of PHP errors' setting in MODX system configuration:

                    https://github.com/Jako/evolution/commit/f8d7bede86b5a78b0c972c7b8e1d21121933ff90
                      • 21144
                      • 4 Posts
                      - Is there a fix for being able to add or edit a snippet in Evo 1.0.12?

                      - This thread is difficult to follow, but it seems there is no solution to tell a developer. My question is what is the fix and where in the code can repair be applied?

                      - (It is possible to duplicate a record, then edit it directly in the database, using phpMyAdmin, for example. But that is a bit clumsy.)