Announcement

Collapse
No announcement yet.

Levels ReadyTheme and Transients Module

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Levels ReadyTheme and Transients Module

    Is there a way to use the Transients module for the navigationsets in the Levels Readytheme?

    The problem I'm having is that Levels has two menus. One starts with "main" and calls "all-categories". The other starts with "all categories" and calls "main", but with l.settings:navigation_version set to "mobile".

    The problem is that only one version or the other (mobile or desktop) gets saved into the transients table. If it's the mobile version that gets saved, the output is wrong on the desktop site. If it's the desktop version that gets saved, the output is wrong on the mobile site.

    The only thing I can think to do is duplicate the menus so that there's one only for mobile and one only for desktop - that way all four (main desktop, all-categories desktop, main mobile, and all-categories mobile) get saved as separate navigationsets.

    Thanks in advance,
    Susan
    Susan Petracco
    NetBlazon

    1.866.400.2444

    _____________________________________________

    Like us on Facebook

  • This is what I has done in the past for other Levels ReadyThemes:

    Create two content sections:
    • Mobile_nav
    • Desktop_nav

    Mobile_Nav will have the following code:
    Code:
    <mvt:assign name="l.settings:navigation_version" value="'mobile'" />
    <div id="js-mobile-navigation" class="mobile-navigation">
           <mvt:item name="readytheme" param="navigationset( 'navigation_all-categories' )" />
    </div>
    Desktop_nav will have the following code:
    Code:
    <mvt:assign name="l.settings:navigation_version" value="''" />
    <mvt:item name="readytheme" param="navigationset( 'navigation_main' )" />
    This will replace <mvt:item name="readytheme" param="navigationset( 'navigation_all-categories' )" />:
    Code:
    <mvt:do file="g.Module_Root $ '/modules/util/transients.mvc'" name="l.settings:mobile_nav" value="Transient_ReadyTheme_ContentSection( 'mobile_nav', 24*60*60, l.settings )" />
    <mvt:if expr="l.settings:mobile_nav">
           &mvt:mobile_nav;
    <mvt:else>
           <mvt:comment> <!-- Failsafe! --> </mvt:comment>
           <mvt:item name="readytheme" param="contentsection( 'mobile_nav' )" />
    </mvt:if>
    This would replace <mvt:item name="readytheme" param="navigationset( 'navigation_main' )" />
    Code:
    <mvt:do file="g.Module_Root $ '/modules/util/transients.mvc'" name="l.settings:desktop_nav" value="Transient_ReadyTheme_ContentSection( 'desktop_nav', 24*60*60, l.settings )" />
    <mvt:if expr="l.settings:desktop_nav">
           &mvt:desktop_nav;
    <mvt:else>
           <mvt:comment> <!-- Failsafe! --> </mvt:comment>
           <mvt:item name="readytheme" param="contentsection( 'desktop_nav' )" />
    </mvt:if>
    This will cache both a mobile version, and a desktop version which should output to the page like it currently does.

    Matt Zimmermann
    Director of UI/UX Standards and Theme Development
    / Miva, Inc.

    Comment


    • Thank you! This is really neat. I'm going to experiment with this. Even if the cache was set to like 15min it would still be very useful.
      Colin Puttick
      I solemnly swear that I am up to no good...

      Comment


      • Thank you Matt!
        Susan Petracco
        NetBlazon

        1.866.400.2444

        _____________________________________________

        Like us on Facebook

        Comment

        Working...
        X