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 Raymond,

    I’ve only just managed to get back to this.

    I initially tried the dynamic version, as I wished to add an include for a forum shoutbox, in addition to the who’s online information. This initially looked great, no problem. However, the data is not updated with page refreshes. I have now also tried the other version you posted, but again, no joy.

    I’m still a bit confused by all the possible ways of doing things with modx, so I’ll explain what I did, just in case that’s the cause of the problem.

    I created a snippet with the dynamic code. I then created a TV with a bit HTML and the call for the dynamic snippet. I then made the call in the template for the TV.

    Any ideas? It seems to work flawlessly apart from the updating issue.

    Thanks.
      • 10487 MODX Staff
      • 1,535 Posts
      Hi Colin,

      This could be a symptom of the combination of page and snippet caching. How are you calling the snippet? If you have the page cached, then you could try calling the snippet uncached: [!mySnippet!]

      Just a thought,

      Garry
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 37272
        • 216 Posts
        Hi Garry,

        Yes, that’s it. I had looked at caching, but forgot about the actual call from the TV for the snippet. I’ve now changed it over to the [!snippet!] form.

        Thanks.
          • 25663 MODX Staff
          • 12,272 Posts
          The SMF stuff here definitely requires 1.1RC2.
            Ryan Thrash, MODX Co-Founder
            Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
            • 4273
            • 356 Posts
            I tried all the examples above and could not get it to work, Modx erros

            I thought the intial php include at to be at the top of thet page before the <html> ?

            from the examples above sounds like you say put it in the document

            i have a snippet called SSI i added the examples above now where would we add that snippet ?

            there’s 2 i think SSI and then the actual item we want to include
              SMF Bookmark Mod - check it out
              http://mods.simplemachines.org/index.php?mod=350
              • 37272
              • 216 Posts
              Hi Bugs,

              This is what I’ve have done.

              Create a snippet called "SSI".

              Snippet content:

              /**
               * SSI Snippet 
               * Param: &fnc - function to be called
               */
              
              $fnc = isset($fnc) ? $fnc:'';
              
              ob_start();
              // set SSI path and file name
              $ssi = '/home/xxxxxx/public_html/community/SSI.php'; 
              include_once($ssi);
              
              // call SSI function here
              if (function_exists($fnc)) @$fnc();
              
              $html = ob_get_contents();
              ob_end_clean();
              
              return $html; // return html content


              Correct the above to your server path.

              Create a document "x".

              This is the content of doc "x":

                  <div id="shouthead">Shoutbox
                  </div>
                  <div id="shoutbox" class="feed1">[!SSI? &fnc=`ssi_shout`!]
                  </div>
              


              This is the content of a second doc, "y":

                  <div id="onlinehead">Online
                  </div>
                  <div id="online" class="feed1">[!SSI? &fnc=`ssi_whosOnline`!]
                  </div>
              


              Create a TV "block-a".

              Input type: (I used "text", but "file" might make more sense).

              Default value: @DOCUMENT x


              Create another TV, "block-b".

              Input type: text.

              Default value: @DOCUMENT y


              In your template, place "[*block-a*]" and "[*block-b*]" where you’d like TVs to appear. I used TVs so that I don’t have to have the includes appear on all pages where I use the template. "x" and "y" are the IDs of the particular documents you create to contain the SSI calls. You do not need the include at the head of your template. The snippet takes care of this for you!
                • 37272
                • 216 Posts
                Hi Jason, and all,

                I’m using this to make a call to the SMF SSI login. There’s no problem with logging in, but I receive a session verification error when I try logging out from my webpages. Any ideas?

                Thanks.
                  • 10487 MODX Staff
                  • 1,535 Posts
                  Hi Colin, I tried the exact same thing a while back and couldn’t get it to work either - SMF does something really strange with the session id’s. I did start looking into it to see if I find a solution but ended up getting deeper and deeper into the SMF core files that it made SSI seem pointless.

                  Maybe someone else has had better success with this ...
                    Garry Nutting
                    Senior Developer
                    MODX, LLC

                    Email: [email protected]
                    Twitter: @garryn
                    Web: modx.com
                    • 37272
                    • 216 Posts
                    Hi,

                    I’ve just tested this with some almost identical pages that I’ve created outside of the manager, and it works without a hitch. Could this be an issue with the cookie name? From what I understand, the cookie name cannot be set with Modx. If this is the cause of the problem, does anyone have a solution? My guess is that this has probably been addresses with the SMF bridge. I’ll give that thread the once-over.
                      • 37272
                      • 216 Posts
                      I’ve been playing with this, and getting nowhere. I tried a variation of the code posted by Raymond, earlier, but it’s just not working.

                      ob_start();
                      // set SSI path and file name
                      $ssi = '/home/XXXXXX/public_html/community/SSI.php'; 
                      include_once($ssi);
                      
                      global $context;
                      if ($context['user']['is_guest'])
                      {
                      echo '<a href=http://www.XXXXXX/community/index.php?action=login>Login</a>';
                      }
                      else
                      {
                      ssi_logout($_SESSION['logout_url']);
                      }
                      
                      
                      $html = ob_get_contents();
                      ob_end_clean();
                      
                      return $html; // return html content
                      


                      It’s plain hackery from me, but there are no errors reported with it.

                      Even I realise that the session ID is not being passed across from the forum. This is a Modx issue though; pages not using the Modx framework work exactly as they should.

                      Anyone? - Don’t make me beg, that just embarrasses everyone! grin Seriously though, I will soon have to implement a less than satisfactory solution if no has an answer.

                      Thanks.