We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24731 ☆ A M B ☆
    • 211 Posts
    I had some problems calling and processing the snippet when the snippet was called more than once on the same page.

    For example, I have it permanently in my template on the sidebar, but I wanted a custom form and profile form to display as a page content, hence I had one snippet call on the template and another one on the page content. Problems occur when processing forms, since some fields are duplicate the form doesn’t process well unless you remove the extra calls.

    My workaround for this was using a bit of phx and other snippets in my template, so I am calling like this:

    [+phx:if=`[[GetField? &field=`id`]]`:isnt=`88`:and:isnt=`89`:then=`<h2>Login:</h2><div id="sidebarlogin">[!WebLoginPE? &lang=`en` &type=`simple` &liHomeId=`49` &loHomeId=`49` &regHomeId=`88` &profileHomeId=`89`!]</div>`+]

    So if the current page IS NOT my registration or profile page (88 or 89) then it can call the snippet, otherwise, it will not be called.

    This way I managed to get it working correctly but I figure this not to be very user friendly.

    Ditto deals with this by using a ditto ID parameter so multiple Ditto calls can be made on the same page and each one with its own placeholders and tags identified by each ditto unique ID. I wonder if maybe I overlooked something in the documentation but I see no other way to come around this situation.

    Anyone has any other ideas or comments?

    Regards,
    Jose R. Lopez
      • 19116
      • 7 Posts
      Hi.

      I had the same problem :
      a weblogin "simple" in the header of the site (for login)
      and an other weblogin "register" on a page.
      Submitting the register didn’t work because weblogin in the header interfered
      (putting the weblogin "simple" code lower than "register" in the html page didn’t help).

      The Phpx solution didn’t work for me aswell.

      My workaround is to use Personalize instead of webloginpe for the login header. And that works
      along with webloginpe to handle all the rest :

      ■ In login header :
      [!Personalize? &yesChunk=`LoginSuccessTpl` &noChunk=`LoginFormTpl` &ph=`user.username`!]


      ■ LoginFormTpl as the default one but without the [~[*id*]~] :
      <div id="wlpeLogin">
        <form id="wlpeLoginForm" action="[~18~]" method="POST">
        ...

      (Where 18 is the id of my register page)

      ■ LoginSuccessTpl :
      <div id="wlpeUserLogged">
      	<div id="wlpeUserInfo">
      			Bienvenue <a href="[~20~]">[+user.username+]</a>
      			<form id="wlpeUserForm" action="[~18~]" method="POST">
      			<button type="submit" id="wlpeLogoutButton" name="service" value="logout">Déconnexion</button>
      	    </form>
      	</div>
      </div>

      (Where 20 is the Profile page and 18 the Register page (in fact it’s a "simple" weblogin))

      ■ The register page (id=18) :
      [!WebLoginPE? &lang=`fr` &type=`simple` &regType=`instant` &groups=`clients` &regRequired=`username,password,fullname,email,phone,comment,tos,captcha` &regSuccessId=`2` &messageTpl=`MessageTpl` &loginFormTpl=`LoginFormTpl` &successTpl=`LoginSuccessTpl` &resetTpl=`ResetTpl` &liHomeId=`2` &loHomeId=`2` &registerTpl=`RegisterInstantFormTpl` &registerSuccessTpl=`RegisterSuccessTpl` &tosChunk=`TosChunk` &notifyTpl=`NotifyTpl` &notifySubject=`NotifySubject` &notify=`[email protected]`!]

      (It’s no longer a "register" webloginpe but a "simple" because it now handles all operations except the Profile view that is on the page 20)

      ■ RegisterTpl is the normal one, with action="[~[*id*]~]"


      So : the login and "Register me" operation (clicked in the header) are redirected to the register page (18)
      because of the action="[~18~]" in the LoginFormTpl.
      That works great.
      The only problem is that it seems the referer redirection don’t work. If I don’t set &liHomeId=`2` &loHomeId=`2` it stays on the Register page after login.


      Feel free to ask question if you need more details.
      And sorry if my english is not really fluent.

      EDIT1 : Actually that doesn’t works very well on Internet Explorer. It’s weird because it’s not a client feature.
      When clicking a header button (Sign-In or Sign-Up) :
      ■ On Firefox : it redirects on the webloginpe page (the "simple" on) and it execute the Service (so it log you in or it print the registration page.
      ■ On IE : it redirects but DOESN’T execute the Service. To works the webloginpe page have to be open when sending the Service request from the header : it kills the purpose of a satelite login form.

      [b]EDIT2 : Found a workaroud ! IE drive me mad.(/b]
      The problem comes from <button>. I had to change the buttons to <input type="submit">, that that works.
      The change is only needed in the header login (the with [!Personalize I recall).
      So you have to change :
      <button type="submit" id="wlpeLoginButton" class="formbutton" name="service" value="login">Log-in</button>

      TO
      <input type="image" id="wlpeLoginButtonHead" class="formbutton" src="loginForm.png" name="service" value="login" title="Log-in" alt="Log-in" />

      And his little <button> brothers too. (Notice type="image" and not "submit").

      EDIT3 : It’s seems that this solution doesn’t work every time. Here is my second workaround :
      ■ In the login form (in the header) replace every <button> by a <a> equivalent (except for the "login" button) :
      <a id="wlpeReminderButtonHead" href="[~18~]?service=forgot" class="formbutton" >Forgot my password</a>
      

      ■ For the "login" button (we can’t send login/pass through GET paramaters) : I let the normal <button> and I add this in the form :
      <input type="hidden" name="service" value="login" />
      

      So, by default, the service is "login". Others <a> button override that.
        • 27330
        • 884 Posts
        So there isn’t a formal workaround for more than one call on the same page?
          • 24731 ☆ A M B ☆
          • 211 Posts
          My guess is not from what I’ve seen. I’ve been however successful using PHX. PHX is a great plugin and I cannot imagine a MODx site without it.

          Jose
            • 20206
            • 9 Posts
            I’m using two instances on my site and it seems to work fine smiley
              • 27330
              • 884 Posts
              Pirate maybe you can clear this up for us? smiley
                • 24731 ☆ A M B ☆
                • 211 Posts
                interesting, i just did a new setup with the latest version and it works now.

                Upgrade and give it a try.

                Jose
                  • 28033
                  • 925 Posts
                  Quote from: redstormj at Mar 10, 2008, 05:40 AM

                  My guess is not from what I’ve seen. I’ve been however successful using PHX. PHX is a great plugin and I cannot imagine a MODx site without it.

                  Jose

                  I would use PHx, but the MyBB plugin has issues w/ it, and the developer doesn’t seem to want to fix it. >.>
                    My Snippets
                    -> PopUpChunk v1.0
                    • 27330
                    • 884 Posts
                    Quote from: redstormj at Mar 11, 2008, 05:28 PM

                    interesting, i just did a new setup with the latest version and it works now.

                    Upgrade and give it a try.

                    Jose

                    I’m using 1.3 and still have this issue on my register page. I’ll try the phx fix now.

                    edit: PHx rock smiley
                    thanks redstormj for posting your question smiley
                      • 24731 ☆ A M B ☆
                      • 211 Posts
                      hehehe, I bet you will find as time goes by tons of new usage of PHX. I use it extensively on modx. I honestly cannot imagine modx without it.

                      Jose