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

    I have no problems with SMF includes, but I cannot get them to work with Modx.

    I understand that I should use them within snippets, but I get errors.

    Do I still include the php call at the head of the page:

    <?php
    require("/home/xxxxxx/public_html/community/SSI.php"); 
    ?>


    I get errors that suggest that I should remove parts of the code, but I cannot get it to work.

    Also, the actual calls within the body also cause errors:

    <?php ssi_whosOnline(); ?>


    In addition, which form of snippet do I use? I imagine it would not matter which for the "require" snippet, and the uncachable form for the actual calls?

    Thanks.
      • 18397
      • 3,250 Posts
      Ok, to include SMF SSI you need to patch SMF. Jason can provide more details. Then create a snippet with just the include line and return the stuff you want to show. That’s it!
        • 37272
        • 216 Posts
        Thanks Mark.

        Jason? I’ve just taken a look at the member list, and all the Jasons listed have no posts, so I assume it’s someone else.
          • 37272
          • 216 Posts
          I’ve perfomed some searches. I assume you mean Kunal Kapoor. I’ll send him a PM.

          Thanks.
            • 7923
            • 4,213 Posts
            Jason == Jason Coward == OpenGeek


              "He can have a lollipop any time he wants to. That's what it means to be a programmer."
              • 37272
              • 216 Posts
              Ah,

              Thanks Dose.
                • 22303 MODX Staff
                • 10,725 Posts
                Sorry folks, took some time away from the computer this evening (for once). And I knew someone was going to ask about this and I was going to forget what I did. Darn it. Can someone paste the error that is triggered? That should trigger my memory, and I don’t have an SMF install laying around to play with at the moment.
                  • 37272
                  • 216 Posts
                  The require part creates the following error:

                  Parse error: syntax error, unexpected ’<’ in /home/xxxxxx/public_html/manager/includes/document.parser.class.inc.php(696) : eval()’d code on line 1

                  When I add the call, the following error occurs:

                  Fatal error: Call to undefined function: ssi_whosonline() in /home/xxxxxx/public_html/manager/includes/document.parser.class.inc.php(696) : eval()’d code on line 1

                  Let me know if you require anything else.

                  Thanks.
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Sounds like some extra <?php tags in the file. Take a look at lines 1 and 2 of the snippet.
                      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
                      • 37272
                      • 216 Posts
                      Hi Susan,

                      I had already tried removing the <?php (and the closing tag), not knowing the syntax when using a snippet for php includes. It made no difference. I’ll do it again now, and see what error was/is generated . . . .

                      . . . . much worse!

                      « MODx Parse Error »
                      MODx encountered the following error while attempting to parse the requested resource: 
                      « PHP Parse Error » 
                        
                      PHP error debug 
                        Error:  mysql_query(): supplied argument is not a valid MySQL-Link resource   
                        Error type/ Nr.:  Warning - 2   
                        File:  /home/xxxxxx/public_html/community/Sources/Subs.php   
                        Line:  288   
                        Line 288 source:  $ret = mysql_query($db_string, $db_connection);    
                        
                      Parser timing 
                        MySQL:  0.0022 s s (3 Requests) 
                        PHP:  0.1491 s s   
                        Total:  0.1512 s s 
                      


                      The snippet contained (before this edit) exactly what I stated in my first post. As I understand it, there is clash of some kind, and Opengeek has a solution.