We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4385
    • 372 Posts
    Instead of putting some debug information on my pages I thought it made more sense to put it into quickedit


    I got this far. I am more of a designer and a cut n’ paste php user. How can I get the timings ([^q^] etc.) to render?



    english.inc.php

    $QE_lang[’timing’] = ’Timing’;
    $QE_lang[’QE_query_time’] = ’Query time’;
    $QE_lang[’QE_query_count’] = ’Query count’;
    $QE_lang[’QE_parse_time’] = ’Parse time’;
    $QE_lang[’QE_total_time’] = ’Total time’;


    output.class.inc.php

    $menus = array (
    ’content’ => array (),
    ’setting’ => array (),
    ’timing’ => array(),
    ’go’ => array ()
    );


    $menus[’timing’][] =<<<EOD
    {$QE_lang[’QE_query_time’]}: [^qt^]
    EOD;

    $menus[’timing’][] =<<<EOD
    {$QE_lang[’QE_query_count’]}: [^q^]
    EOD;

    $menus[’timing’][] =<<<EOD
    {$QE_lang[’QE_parse_time’]}: [^p^]
    EOD;

    $menus[’timing’][] =<<<EOD
    {$QE_lang[’QE_total_time’]}: [^t^]
    EOD;
      DropboxUploader -- Upload files to a Dropbox account.
      DIG -- Dynamic Image Generator
      gus -- Google URL Shortener
      makeQR -- Uses google chart api to make QR codes.
      MODxTweeter -- Update your twitter status on publish.
      • 4385
      • 372 Posts
      Is this even close? I am stuck. Any help?
        DropboxUploader -- Upload files to a Dropbox account.
        DIG -- Dynamic Image Generator
        gus -- Google URL Shortener
        makeQR -- Uses google chart api to make QR codes.
        MODxTweeter -- Update your twitter status on publish.
        • 27376
        • 576 Posts
        This is not possible. The Quickedit plugin is executed [tt]OnWebPagePrerender[/tt] which is AFTER the timing strings are injected in to the output.

        I put the timing tags inside HTML comments so that anyone not looking for it won’t see it and I can still check the timings on every single page without even having to log in.
          • 7231
          • 4,205 Posts
          You could also put it in a chunck and use a snippet like ManagerOnly to only show the chunck when logged in as manager thus keeping the timings private.
            [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]
            • 4385
            • 372 Posts
            @sirlancelot: ok, thank make a lot more sense now.

            @dev_cw: I think i will try that, maybe use the same css as quickedit and make it look more unified.

            I could some javascript to "write" into a container on the quickedit menu.

            Thanks!
              DropboxUploader -- Upload files to a Dropbox account.
              DIG -- Dynamic Image Generator
              gus -- Google URL Shortener
              makeQR -- Uses google chart api to make QR codes.
              MODxTweeter -- Update your twitter status on publish.
              • 4385
              • 372 Posts
              ok, so this worked. I changed output.class.inc.php to...

              			$menus = array (
              				'content' => array (),
              				'setting' => array (),
              				'timing' => array(),
              				'go' => array ()
              			);
              
              			$menus['timing'][] =<<<EOD
              {$QE_lang['QE_query_time']}: <span id="qt">{[^qt^]}</span>
              EOD;
              
              			$menus['timing'][] =<<<EOD
              {$QE_lang['QE_query_count']}: <span id="q">[^q^]</span>
              EOD;
              
              			$menus['timing'][] =<<<EOD
              {$QE_lang['QE_parse_time']}: <span id="p">[^p^]</span>
              EOD;
              
              			$menus['timing'][] =<<<EOD
              {$QE_lang['QE_total_time']}: <span id="t">[^t^]</span>
              EOD;



              then added some mootool voodo

              <script type="text/javascript">
              	window.addEvent('load', function() {
              		$('qt').setHTML('[^qt^]');
              		$('q').setHTML('[^q^]');
              		$('p').setHTML('[^p^]');
              		$('t').setHTML('[^t^]');
              	});
              </script>


              It only worked when I added it to the template. I tried to make it a plugin to add it to ever page of the front end, but it would not update the timing strings even when I used OnWebPageComplete (which I assumed is the very last thing after OnWebPagePrerender)

                DropboxUploader -- Upload files to a Dropbox account.
                DIG -- Dynamic Image Generator
                gus -- Google URL Shortener
                makeQR -- Uses google chart api to make QR codes.
                MODxTweeter -- Update your twitter status on publish.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                OnWebPagePrerender is invoked just before the final "echo" statement that sends the parsed document to the server to be rendered, so anything you want in the document has to be added on or before that event.

                onWebPageComplete is invoked after the page has been finished and sent to the server, and is only invoked if track_visitors is set to 1. It’s intended for dealing with tracking and statistics.

                (Yes, I do spend whole evenings poring over the document.parser.inc.php file. And no, I don’t have a life grin )
                  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
                  • 27376
                  • 576 Posts
                  Quote from: bwente at Mar 19, 2008, 11:13 PM

                  then added some mootool voodo

                  ...

                  It only worked when I added it to the template. I tried to make it a plugin to add it to ever page of the front end, but it would not update the timing strings even when I used OnWebPageComplete (which I assumed is the very last thing after OnWebPagePrerender)
                  Very clever! That works because the timing strings are inside the main template (within that little JS snippet). If you look at the source code of one your pages you’ll see. You can use the MODx Order of execution as a reference.

                  That’s definitely thinking outside the box wink