We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3785
    • 143 Posts
    Hi betoranaldi,

    I just installed DocFinder using the instruction and now when I click on the Doc Finder button under the modules tab and get a blank page. Nothing renders, I tried re uploading all of the files and it doesn’t help.

    I guess you forgot to paste the module code when you created the Doc Finder Module?

    include($modx->config['base_path']."assets/modules/docfinder/index.php"); 
      Medianotions – Studio für Webdesign
      http://www.medianotions.de
      • 3232
      • 380 Posts
      Quote from: paulb at Dec 05, 2008, 11:58 AM

      You might check to see if the php short_open_tag option is turned off in the php.ini file. (You can create a file with nothing but this in the content to test it: <?php phpinfo(); ?>) If short tags are off, the module won’t work until you either turn short tags on (not recommended) or search and replace all the short tags with long tags (see the last paragraph of my previous post above).

      I replaced all of the tags and still get a blank page

      Quote from: Bogdan at Dec 05, 2008, 12:03 PM


      I guess you forgot to paste the module code when you created the Doc Finder Module?

      include($modx->config['base_path']."assets/modules/docfinder/index.php"); 


      I have this in my module code area.

      The strange thing is, if I remove the directory from the assets/module folder, I get the same result.

      Is there anyway i can check to see if the file is being pulled in?

      If i run http://mydomain.com/assets/modules/docfinder/index.php I still get a blank page.
        • 22797
        • 134 Posts
        Quote from: betoranaldi at Dec 05, 2008, 12:35 PM

        Is there anyway i can check to see if the file is being pulled in?

        Put this line at the very top of the Doc Finder index.php file:

        <?php die('yes, it was included.'); ?>


        That will tell you if it was included or not (you’ll need to remove the line later).

        If it is not included, try typing the full path in the call to the module. It might look something like this:

        include '/home/user/public_html/assets/modules/docfinder/index.php';


        Of course, you have to get the path right, or it won’t work.
          • 3232
          • 380 Posts
          Quote from: paulb at Dec 05, 2008, 12:41 PM

          Quote from: betoranaldi at Dec 05, 2008, 12:35 PM

          Is there anyway i can check to see if the file is being pulled in?

          Put this line at the very top of the Doc Finder index.php file:

          <?php die('yes, it was included.'); ?>


          That will tell you if it was included or not (you’ll need to remove the line later).

          If it is not included, try typing the full path in the call to the module. It might look something like this:

          include '/home/user/public_html/assets/modules/docfinder/index.php';


          Of course, you have to get the path right, or it won’t work.

          Yes it returns "yes, it was included"

          I have tried the full path.

          I also just took a look at phpinfo and short_open_tag is On
            • 3785
            • 143 Posts
            betoranaldi, can you check if the Doc Finder index.php file is all in one line? This can happen on some systems / with some software because of the different types of line endings. As the index.php file starts with a comment (//) everything in there would be considered to be a comment if there is only one big line.
              Medianotions – Studio für Webdesign
              http://www.medianotions.de
              • 3232
              • 380 Posts
              Quote from: Bogdan at Dec 05, 2008, 02:44 PM

              betoranaldi, can you check if the Doc Finder index.php file is all in one line? This can happen on some systems / with some software because of the different types of line endings. As the index.php file starts with a comment (//) everything in there would be considered to be a comment if there is only one big line.

              It appears as it should, everything is NOT on one line.
                • 3785
                • 143 Posts
                Strange. I have no explanation for this behavior. Another thing you can do is to copy the content if the index.php into the module content and delete the line there where it is included.

                If this still does not work you can maybe provide me with a temporal access to your MODx installation so I can have a look at it.
                  Medianotions – Studio für Webdesign
                  http://www.medianotions.de
                  • 3785
                  • 143 Posts
                  Hello Paul,

                  thanks for getting so late back to you, I am quite busy at the moment.

                  I took a look at your updated code. I see that you added the call to the OnBeforeDocFormSave and OnDocFormSave events. The way the code is set up now, though, you’re assuming that the only events that need to be invoked are those two. But if the user is replacing content in a snippet or chunk or TV or something else, your script will not work as intended. You will need to use the other events too:
                  OnBeforeChunkFormSave,
                  OnChunkFormSave,
                  OnBeforeSnipFormSave,
                  OnSnipFormSave,
                  [...]

                  Yes you are right, I have to distinguish between the different types of content that re replaced and this would be easy to handle. But another thought just came into my mind: all the events have to do something with "form" (OnBeforeDocFormSave, OnChunkFormSave, ...). After thinking about it I am not sure if I should trigger this events in the Doc Finder code at all as I am not handling with the form in any way but write the replaced content directly to the database.

                  The question is if this events are indeed closely related to the manager (form) or are also meant to be triggered when the database is directly manipulated. Maybe someone of the core developer team can help us with this question.

                    Medianotions – Studio für Webdesign
                    http://www.medianotions.de
                    • 22797
                    • 134 Posts
                    Quote from: Bogdan at Dec 07, 2008, 05:23 AM

                    Yes you are right, I have to distinguish between the different types of content that re replaced and this would be easy to handle. But another thought just came into my mind: all the events have to do something with "form" (OnBeforeDocFormSave, OnChunkFormSave, ...). After thinking about it I am not sure if I should trigger this events in the Doc Finder code at all as I am not handling with the form in any way but write the replaced content directly to the database.

                    The question is if this events are indeed closely related to the manager (form) or are also meant to be triggered when the database is directly manipulated. Maybe someone of the core developer team can help us with this question.

                    Even though the word "form" is in the name of the event, those are the only events available to trigger actions upon saving items. The triggers don’t have anything to do with the forms explicitly. They are just events that happen before and after saving. Usually that happens when using the forms (hence the name), but, as in the case of your module, the forms are not being used. I can’t see that it would cause any problems, since the events themselves don’t touch the forms.

                    However, you do have to make sure the right information is sent to the event. For example, the OnBeforeDocFormSave trigger is an array with two keys: ’mode’ and ’id’.
                    $modx->invokeEvent("OnBeforeDocFormSave", array (
                        "mode" => "upd",
                        "id" => $id
                    ));
                    

                    The OnBeforeModFormSave event also uses ’id’ as one of the keys:
                    $modx->invokeEvent("OnBeforeModFormSave",
                        array(
                        "mode"	=> "upd",
                        "id"	=> $id
                    ));	

                    ... so of course you have make sure that your code doesn’t confuse the different kinds of ids. Depending on how your code is written, you might have to use different variables like $docId and $moduleId.
                      • 22797
                      • 134 Posts
                      From your question, I realized there is a weakness in the way Modx handles "save" system events. I started a new thread about system events here: http://modxcms.com/forums/index.php/topic,31217.0.html

                      Despite this weakness, I still think it is appropriate to invoke the events in your module as I described, because if they’re not invoked, scripts that depend on these events will be bypassed. When/if the Modx system events get updated to be more robust, it may be appropriate to modify the way the events are called in your module, but that won’t be for a while, I think. Calling the ones that are available now is still the best option.