We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24191
    • 7 Posts
    Is there a way to force Modx to pull a fresh page when logged in for editing?

    Goal
    ---------
    I really like the QuickEdit functionality and want to add a custom QuickEdit tags to edit the image href.

    Problem
    ---------
    The {*# syntax doesn’t work well inside a HREF. It places html coded inside the HREF. Not so good. So I tried the custom HTML tags. Functionally it worked great. The problem with the custom HTML tags are they are not strict XHTML compliant.

    Solutions I tried
    ----------
    In response, I wrote a snippet that checks the session variable. If the user is logged in to edit, then write the custom QuickEdit tag. The newest issue I have is with caching. I need to enable caching throughout the site, but hoped that Modx would turn off caching when logged in and using QuickEdit.

    I can’t think of an advantage of editing a cached page versus a non-cached page. I assume after editing, the page would cache on first call.

    My Question
    -----------
    In summary, does anyone know of a setting or code to turn off server side caching if user is logged in for editing?

    Thanks,
    Quad
      • 24191
      • 7 Posts
      Just to clarify ...

      I have a chunk called template_image:

      [!addQuickEditTag!]
      <a title="[*ImageDescription*]" rel="lightbox" href="[*CommonRightLargeImg*]"><img src="[*CommonRightImg*]" alt="[*ImageDescription*]" /> </a>

      The call to the snippet addQuickEditTag:

      <?php
      if($_SESSION["usertype"] == "manager") {return "<quickedit:ImageDescription /><quickedit:CommonRightImg /><quickedit:CommonRightLargeImg />"; }
      ?>

      If I change the call to the snippet from [! !] to [[ ]]], we see the cached version in edit mode. If I keep the [! !], I assume we aren’t cached any more. Right?



        • 22303 MODX Staff
        • 10,725 Posts
        Quote from: quadland at May 07, 2009, 11:26 AM

        If I change the call to the snippet from [! !] to [[ ]]], we see the cached version in edit mode. If I keep the [! !], I assume we aren’t cached any more. Right?
        Correct quadland, that code will not be cached as a result of the [! !] syntax, and will execute on every access to the page.
          • 24191
          • 7 Posts
          I want all the elements of the page to cache 99% of the time for the general users, just not when logged in for editing via QuickEdit. Is there a simple solution to have the snippets pull the non-cached version when logged in as a manager but pull the cached version the rest of the time?
            • 25663 MODX Staff
            • 12,272 Posts
            There are a couple of alternatives to QuickEdit that might be more suited to your needs (I think called quick manager or qm+). QuickEdit is in need of an overhaul in general. Have you explored the alternatives?


              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me