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

    I have a severe Problem with Weblogin and PHx.

    I am using a PHx call in my template changing two column layout to a three column layout if needed. Now in a page I need the WebLogin. But WebLogin somehow disables PHx, loading both templates at the same time. Anyone an idea how I could fix that?

    My Templates looks like this
    [+phx:if=`[*sidebar*]`:is=``:then=`<div id="wrapContent">
    <div id="breadcrumb">[!Breadcrumbs? &homeId=`194` &showCrumbsAtHome=`0` &showHomeCrumb=`0` &titleField=`menutitle`!]</div>
    <div id="cont2" class="group"><h1>[*longtitle*]</h1>[*content*]</div></div>`:else=`<div id="wrapContent">
    <div id="breadcrumb">[!Breadcrumbs? &homeId=`194` &showCrumbsAtHome=`0` &showHomeCrumb=`0` &titleField=`menutitle`!]</div>
    <div id="contLeft"><h1>[*longtitle*]</h1>[*content*]</div>
    <div id="sidebar">[*sidebar*]</div></div>`+]


    my system
    Evo 1.0.4
    weblogin as in evo 1.0.4
    PHP 5.3.2
    PHx 2.1.3

    your Help is much appreciated
    • Wrap your external placeholders in a snippet:
      $ph = $modx->getPlaceholder('placeholder-name');
      return $ph;

      The phx plugin eats external placeholders. That’s one reason why I never use it; I use snippets instead. For internal use where it’s included with the snippet (in Ditto and Jot chunk tpls for example) it’s fine.
        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
        • 2901
        • 277 Posts
        Hi Susan

        thanks for your reply, guess I am not good enough in PHP to write this snippet.

        thanks again
        • What I gave you will work; all you need to do is replace the "placeholder-name" with the name of the placeholder.

            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
            • 2901
            • 277 Posts
            Susan

            I still don’t get it. You mean I should wrap my PHx from above into a snippet and call it as snippet?
            • No. If you have a placeholder [+username+], phx will destroy the tags before MODx gets a chance to process it. The value is still in the $modx->placeholders array, though. So instead of using snippet tags you’ll use a snippet:
              $ph = $modx->getPlaceholder('username');
              return $ph;

              Put the snippet where you would have put the placeholder. Keep in mind this is only for external placeholders, in your main template or the resource content. Placeholders in chunk tpls used by your WebLoginPE still work, as they are processed directly by WebLoginPE and not MODx.
                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
                • 2901
                • 277 Posts
                Susan thanks

                my problem seems to be different. I have the above PHx in my Template. Whenever I use

                [[WebLogin? &loginhomeid=`8,18,7,5` &tpl=`Login`]]

                modx ignores the complete PHx in my template. So the form is loaded twice into the page.
                • Oh, I see. Sorry about that embarrassed

                  So this phx works on a page, but if you have the [!weblogin!] snippet on the page it loads both blocks of code in your phx? Do you have a link, or is this on a local environment?
                    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
                  • Weblogin snippet (as well as any other dynamic snippets whose value needs to be processed in the next page load) has to be called uncached [!...!], unless the whole resource is uncached.
                      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
                      • 2901
                      • 277 Posts