We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6726
    • 7,075 Posts
    Thanks Raymond, I’ll try this out, and report any error.

    But before I dig into debug, I’ll try to set up an install with the new parser on my TextDrive shared hosting, see if it is an issue on my side. If I have the same problems, then I’ll go digging !
      .: COO - Commerce Guys - Community Driven Innovation :.


      MODx est l'outil id
      • 6726
      • 7,075 Posts
      Raymond, I have turned on error notice in index.php and here is what I get :

      « MODx Parse Error »
      MODx encountered the following error while attempting to parse the requested resource:
      « PHP Parse Error »
       
      PHP error debug
        Error: 	Undefined variable: permaLink	 
        Error type/ Nr.: 	Notice - 8	 
        File: 	/Applications/MAMP/htdocs/gican/manager/includes/extenders/parser.class.php	 
        Line: 	269	 
        Line 269 source: 	$output = $permaLink ? $this->makePermaLink($token,$parameters) : $modx->makeUrl($token,'',$parameters); 	 


      I have the following friendly url setting :

      Use friendly URLs: Yes
      Use friendly aliases: Yes
      Use friendly alias path: Yes
      Allow duplicate aliases: No
      Automatically generate alias: Yes

      It seems there is an error even before the IF tag is parsed... how could I display all errors (edit php.ini ?) ? With stop on notice I’ll have trouble getting to the bottom of this thing...
      How do I turn on the parser debug mode ?
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 32963
        • 1,732 Posts
        Hi David,

        Thanks for the update.

        Here’s a quick fix to the permaLink notice:

        	// process a document link and return value as $output
        	function processLink(&$token,&$output) {
        		global $modx;
        		if(!$token) return '';
        		$this->replaceSimilarTokens = true; // replace similar token	
        		$parameters = $this->popParameters($token,true);
                $permaLink = false;
        		if(substr($token,0,1)=='~') {
        			$token = substr($token,1); // remove extra ~ for perma link format		
        			$permaLink = true; 
        		}
        		$output = $permaLink ? $this->makePermaLink($token,$parameters) : $modx->makeUrl($token,'',$parameters);
        	}


        To enable parser debug mode edit your index.php file and add the following just below stop on notice:

        // enableDebug($state,$stopOnNotice = false)
        $modx->enableDebug(true,true);


        The second param will enable stopOnNotice.

        Many thanks





          xWisdom
          www.xwisdomhtml.com
          The fear of the Lord is the beginning of wisdom:
          MODx Co-Founder - Create and do more with less.
          • 32963
          • 1,732 Posts

          Just to let you know that so far I’ve managed to fix a few bugs and will hopefully release an update some.

          IMO the most important issue that needs to certainly be addressed is the issue of circular reference. Here’s an example of this:

          [[SnippetA]] is programmed to return the value [[SnippetB]]. When [[SnippetB is executed returns the value [[SnippetA]].

          This forms an infinite loop as SnippetA will once again output SnippetB.

          The parser will need to know which Tag is caught in a loop and then make a decision to terminate that loop sad



            xWisdom
            www.xwisdomhtml.com
            The fear of the Lord is the beginning of wisdom:
            MODx Co-Founder - Create and do more with less.
            • 6726
            • 7,075 Posts
            Quote from: xwisdom at Jul 03, 2006, 11:01 AM

            Hi David,

            Thanks for the update.

            Here’s a quick fix to the permaLink notice:

            (...)

            To enable parser debug mode edit your index.php file and add the following just below stop on notice:

            (...)

            The second param will enable stopOnNotice.

            Many thanks

            Great !

            Thanks Raymond I’ll use that and go on with testing !

            Edit : Waow, now the second tip is just awesome as a MODx learning tool !
            You just SEE how things are parsed, how much time it took and how it works grin

            A great feature of the new parser grin

            Update about my problem : seems it’s not the IF tag that is the root of the problem, but something else caused by a chunk, I’ll get back to you about that !
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l'outil id
              • 32963
              • 1,732 Posts
              Here’s a quick movie of the default site with debug enabled.

              A lot of features are planned for the debugger to make it easier to debug your pages but those will come later. On such feature is the ability to set (conditional) breakpoints in the parser.

                xWisdom
                www.xwisdomhtml.com
                The fear of the Lord is the beginning of wisdom:
                MODx Co-Founder - Create and do more with less.
                • 32963
                • 1,732 Posts
                Great news!

                The parser can now detect and break circular reference!

                Consider this:
                [[$NestBox]]
                <div style="padding:5px;width:200px;border:1px solid black;">
                [[$NestBox]]
                </div>
                By adding this to a document will create circular reference.

                The new parser will have an option for you to specify when it should break the loop. It’s still not 100% but it’s getting there


                  xWisdom
                  www.xwisdomhtml.com
                  The fear of the Lord is the beginning of wisdom:
                  MODx Co-Founder - Create and do more with less.
                  • 6726
                  • 7,075 Posts
                  I’ll watch the movie right now !

                  It’s really amazing Raymond I am so excited grin

                  The debugger could also be a great learning tool, I mean I litterally can figure out how things are processed under the hood, which was a little fuzzy to me (remember I am a designer not a coder...).

                  Anyway, I’ll make some more test and report when I encounter some bugs/problems... I’ll also set up a default install to test with.

                    .: COO - Commerce Guys - Community Driven Innovation :.


                    MODx est l&#39;outil id
                    • 7455
                    • 2,204 Posts
                    This is so cool the limits to modx’s posibilities are melting as snow in the sun.

                    Soon I will test this baby when I have more time on my hand Great work david on the testing an bug reports.
                    Exelent job Raymond this will change the whole mod-x thinking in a good way.

                    Dimmy
                      follow me on twitter: @dimmy01
                      • 4195
                      • 398 Posts
                      this is SOOOOO coool smiley
                        Armand Pondman
                        MODx Coding Team
                        :: Jot :: PHx