Announcement

Collapse
No announcement yet.

Debugging while module development

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Debugging while module development

    Hello experts,

    I am developing component module and having some issue.

    Code:
    <MvFUNCTION NAME = "ComponentModule_Page_Assign" PARAMETERS = "module var, page var, item, settings var" STANDARDOUTPUTLEVEL = "">
     <MvEVAL EXPR = "{ Generate_Code_List( l.template_source ) }">
     <MvASSIGN NAME = "l.settings:template_filename" VALUE = "{ tolower( l.page:code ) $ '-' $ tolower( l.item ) $ '.mvc' }">
     <MvASSIGN NAME = "l.settings:template_id"  VALUE = "{ [ g.Module_Feature_TUI_MGR ].TemplateManager_Create_ManagedTemplate_NoDuplicates( l.template_source, l.settings, l.settings:template_filename ) }">
     <MvIF EXPR = "{ l.settings:template_id EQ 0 }">
      <MvFUNCTIONRETURN VALUE = 0>
     </MvIF>
     <MvIF EXPR = "{ NOT [ g.Module_Feature_TUI_MGR ].TemplateManager_Page_Assign_Item( l.page, l.item ) }">
      <MvFUNCTIONRETURN VALUE = 0>
     </MvIF>
    
     <MvFUNCTIONRETURN VALUE = 1>
    </MvFUNCTION>
    Is there simple way to test the value from develop machine?

    Code:
    l.settings:template_filename
    Thanks in advance
    Daniel Kim, Compu-Mate
    Developer

  • You could try evaluating it at the bottom of the function (above the function return):

    <mvt:eval expr="l.settings:template_filename" />

    If that doesn't work or you can't find where it displayed (viewing page/frame source sometimes works) you can try doing a javascript alert just before the function return:

    <mvt:eval expr="'<script> alert("' $ l.settings:template_filename $ ' $");</script>'" />

    Another option is to export the data file using the various file functions.

    <mvt:if expr="sexists('/debug.log')>
    <mvt:assign name="l.ok" value="sdelete('/debug.log')" />
    </mvt:if>
    <mvt:assign name="l.ok" value="file_create( '/debug.log', 'script',l.settings:template_filename )" />

    Then open the debug file either by browsing to it (domain.com/debug.log) or ftp'ing into the site and viewing it that way.

    M.A.D.* since 1997

    http://www.scotsscripts.com

    *miva application developers

    Comment


    • I sometimes put MvEVAL's right in my code to display variables on my screen for debugging. Since this is an admin operation, the module needs to output some white space before the variable; otherwise it will be displayed in a place that is hidden by other page elements.
      Code:
      <MvEVAL EXPR="<p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p>">
      <MvEVAL EXPR="{ '<p>Template filename: ' $ l.settings:template_filename $ '</p>' }">
      HTH --
      Kent Multer
      Magic Metal Productions
      http://TheMagicM.com
      * Web developer/designer
      * E-commerce and Miva
      * Author, The Official Miva Web Scripting Book -- available on-line:
      http://www.amazon.com/exec/obidos/IS...icmetalproducA

      Comment


      • Thanks Scot and Kent

        Displaying information using <MvEVAL> and javascript alert did not work, but logging using debug.log file worked for me.

        <MvEVAL> also worked in ComonentModule_Content function.

        Thanks.
        Last edited by compumate99; 09-12-19, 07:51 AM.
        Daniel Kim, Compu-Mate
        Developer

        Comment


        • FYI:

          Since you didn't define an output level

          STANDARDOUTPUTLEVEL=""

          You wont see anything eval'd within the function.
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment


          • Doesn't MvEVAL display output regardless of STANDARDOUTPUTLEVEL settings?
            M.A.D.* since 1997

            http://www.scotsscripts.com

            *miva application developers

            Comment


            • Even with
              Code:
              STANDARDOUTPUTLEVEL = "text,html,compresswhitespace"
              It does not display anything.
              Daniel Kim, Compu-Mate
              Developer

              Comment


              • Originally posted by Scot - ScotsScripts.com View Post
                Doesn't MvEVAL display output regardless of STANDARDOUTPUTLEVEL settings?
                hasn't been my experiance my i rarely eval directly from a function so we are relying on memories...
                Bruce Golub
                Phosphor Media - "Your Success is our Business"

                Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                phosphormedia.com

                Comment


                • MvEVAL does display values regardless of STANDARDOUTPUT level. If you're not seeing the values then there is no value, OR, it's being displayed up above the top fold and you need to add some whitepace to the top as per Kent's post. It's not easy to see what's going on in the admin because you need to add about 250px of whitepace to the top of the output since the top of the admin content frame is covered by the navbar frame (or something like that.)
                  M.A.D.* since 1997

                  http://www.scotsscripts.com

                  *miva application developers

                  Comment


                  • I don't think the function: ComponentModule_Page_Assign
                    has anywhere to display when an eval function executes. Or, the screen gets overwritten during the ensuing function. Therefore, I suggest to use Kent's alternate suggestion which is to export the data you want to capture in a file. I do this quite a bit even when printing to the screen works because it sometimes breaks the screen anyway.

                    Scott
                    What help do you need today!
                    Interactive Design Solutions http://www.southbound.com
                    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
                    My T-shirt Collection is mostly MivaCon T-shirts!!
                    Competitive Rates, Popular Modules, and Integrations:
                    Product Copy | AutoBaskets | Waitlist Integration| Wholesale Integration

                    Comment


                    • Thanks for all your help.

                      Code:
                      <mvt:if expr="sexists('/debug.log')>
                          < mvt:assign name="l.ok" value="sdelete('/debug.log')" />
                      < /mvt:if>
                      < mvt:assign name="l.ok" value="file_create( '/debug.log', 'script',l.settings:template_filename )" />
                      This works beautifully.
                      Daniel Kim, Compu-Mate
                      Developer

                      Comment


                      • Originally posted by Scot - ScotsScripts.com View Post
                        Doesn't MvEVAL display output regardless of STANDARDOUTPUTLEVEL settings?
                        oh, yea...i was confusing that with just entering say, "<p>Hello World</p>" in a function. as i mentioned, i rarely use that method preferring to place that type of output into a variable...which is why I love <mvcapture> so much. :)
                        Bruce Golub
                        Phosphor Media - "Your Success is our Business"

                        Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                        phosphormedia.com

                        Comment

                        Working...
                        X

                        This website uses cookies to identify visitors, track visitors to our website, store login session information and to remember your user preferences. By continuing to use this site you agree to our use of cookies. Learn More.

                        This website uses cookies. By continuing to use this site you agree to our use of cookies. Learn More.

                        Accept