We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31471
    • 206 Posts
    Quote from: BobRay at Aug 05, 2008, 03:35 PM
    If you set the instance parameter in each snippet call and append the appropriate value to the re-post links in the tpls, the snippet code would know what instance it was responding to...
    Your thoughts are just right, that’s what I did and want to share. If an "instanced" form is posting to the snippet, it posts the instance name as well, so the code will know what to do. The problem is that I did alter the code at so many places by small amounts - like making "[+".$instance."placeholder+]" from "[+placeholder+]" and changing much of the switch case "servicenames" to switch case $instance."servicenames" and so on, that it doesn’t make sense to post it to the forum.
    I’m gonna implement all these changes in a raw 1.31 to post it to /group/webloginpe. I’ve never used an svn yet, but once I saw the versiontrack highlighting of MODx, and hope it’s something easy to use.

    Since this thing has a Wiki, you think we should move the documentation into it, since we’ll have to update/edit Scotty’s eventually?
    If the whole directory of html and .js files could be moved and also been "version-tracked" or updated in Google then it’s worth to do it, yeah! But I don’t know how it’s doin’...
      • 31471
      • 206 Posts
      I connected successfully to w/ the SVN client. Could someone else upload the files for the pending 1.3.2 release...
      Never using an svn though I’m quite sure it’s needed to first upload an initial version.
      I imagine (at least really wish) that Google will track the changes then.

      It would be quite helpul if somebody with some experience in at least other svn’s would explain these to the newbies of us!  undecided

      Or may I ask if the "official" MODx svn would be the right place in a sub-object or what? Beside that I trust in G’ anyway...
        • 3749
        • 24,544 Posts
        Quote from: vhollo at Aug 05, 2008, 04:49 PM

        Quote from: BobRay at Aug 05, 2008, 03:35 PM
        If you set the instance parameter in each snippet call and append the appropriate value to the re-post links in the tpls, the snippet code would know what instance it was responding to...
        Your thoughts are just right, that’s what I did and want to share. If an "instanced" form is posting to the snippet, it posts the instance name as well, so the code will know what to do. The problem is that I did alter the code at so many places by small amounts - like making "[+".$instance."placeholder+]" from "[+placeholder+]" and changing much of the switch case "servicenames" to switch case $instance."servicenames" and so on, that it doesn’t make sense to post it to the forum.
        I’m gonna implement all these changes in a raw 1.31 to post it to /group/webloginpe. I’ve never used an svn yet, but once I saw the versiontrack highlighting of MODx, and hope it’s something easy to use.

        Since this thing has a Wiki, you think we should move the documentation into it, since we’ll have to update/edit Scotty’s eventually?
        If the whole directory of html and .js files could be moved and also been "version-tracked" or updated in Google then it’s worth to do it, yeah! But I don’t know how it’s doin’...

        I just added this at the top:

        $requestInstance = $_REQUEST['wlpeInstance'];
        $requestInstance = empty($requestInstance)? "" : $requestInstance ;    
        $parameterInstance = isset ($wlpeInstance) ? $wlpeInstance : "";
        
        
        /*  set $instanceMatch to false *only* if both are set and they don't match.
            Otherwise, everything works as before.
        */
        
        $instanceMatch = true;
        
        if ( ($requestInstance != "") && ($parameterInstance != "") { 
              if ($parameterInstance != $requestInstance) {
                   $instanceMatch = false;
              }
        }


        Then added

        <a href = "[~[*id*]~]?service=viewprofile&username=[+view.username+]&wlpeInstance=one">[+view.username+]

        and

        <a href = "[~[*id*]~]?service=viewprofile&username=[+view.username+]&wlpeInstance=two">[+view.username+]

        to the respective snippets.

        and this to the snippet code:

        switch ($service)	{
            case 'viewprofile':
                   if (!$instanceMatch) {   //  added
                       return;                      // added 
                  }                                    // added
        
        etc.
        }


          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Ditto uses the dittoID variable; you might want to check it and see how it uses it.
            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
            • 3749
            • 24,544 Posts
            The reason I did it as I did is that I needed two user lists on the same page, both with working viewProfile links (each with its own tpl). Both snippets need to process those links but only respond to the ones triggered in their part of the list (otherwise, you get two profiles every time instead of one).

            I may be misunderstanding it, but I don’t think your method would work for me because you appear to be turning off processing in one snippet and leaving it on in the other. I think my method could work for you though but, again, I may be missing something.

            I tried setting a $wlpeInstance placeholder and using it in the tpls but they’re processed too late and always get the one set in the second snippet call.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 3749
              • 24,544 Posts
              Quote from: sottwell at Aug 05, 2008, 05:38 PM

              Ditto uses the dittoID variable; you might want to check it and see how it uses it.

              I thought about that but, as I understand it, it would require you to add the id to every placeholder (e.g. [+id.placeholder+]). So when you used it, it would break all the existing placeholders for that page. You’d also have to test for and conditionally add the Id everywhere setplaceholder() is called in the entire snippet and class file. Still, it’s a more generic solution and should probably be considered.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 31471
                • 206 Posts
                Hi BobRay!
                I needed two user lists on the same page, both with working viewProfile links (each with its own tpl).
                Did you try this?
                In every tpl’s and forms belonging to an instance modify every placeholder this way: [+instname.view/post.placeholder+] and in the <a href> tags add &instance=instname to the links. Plus add <input type="hidden" name="instance" value="instname" /> in the forms to let the instancename been posted. So the form doesn’t get processed two times.
                I tried setting a $wlpeInstance placeholder and using it in the tpls but they’re processed too late and always get the one set in the second snippet call.
                If you’d let the snippet to write instancename in the form/tpl, it would end up with the second instance’s name in both forms/tpls. That’s why you must hardcode the instname to your forms and tpls. Alternatively give a try to not "instancing" both snippets, only one of them.
                  • 28033
                  • 925 Posts
                  Maybe you guys would know why this is happening...

                  For a while now, I’ve had an issue in WLPE where I need to set it up like this in the snippet file...

                  if (file_exists(MODX_BASE_PATH.'assets/snippets/webloginpe/lang/'.$lang.'.php'))
                  	{
                  		include MODX_BASE_PATH.'assets/snippets/webloginpe/lang/'.$lang.'.php';
                  	}


                  I have to change include_once to include, else the lang file never gets used, and I get a blank message.

                  (Which reminds me, I need to test again now to see if the "ghost" user bug still exists. Basically, WLPE wasn’t stopping accounts from being made, even if they had *badly* corrupted data. And users couldn’t register, because it gave errors like No username specified, when they has inserted one.)
                    My Snippets
                    -> PopUpChunk v1.0
                    • 28033
                    • 925 Posts
                    Something else I noticed. In HTML Tidy, WLPE gives an warning when a username has a space in it.

                    Is there a way to have WLPE rewrite the URL so something like Default User = Default_User?
                      My Snippets
                      -> PopUpChunk v1.0
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Or the correct Default%20User, maybe. It is considered very bad practice to use an underscore in a URL, since the underscore can get hidden by the border of the browser’s address bar. Hyphens are preferred, or an appropriate URL encoding.
                        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