We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • discuss.answer
    • 22427
    • 793 Posts
    @Frogabog

    Crud...@INHERIT doesn't play well with *tvName:isnot=``:then=`
    For me, this works without problems:
    [[*tvName:isnot=``:then=`not empty`:else=`empty`]]

    Although isn't this what If does?
    Because of its flexibility, the If snippet is rather clumsy and can harm the performance if it is called more often in a page (afaik). So a tiny little individual snippet is a leaner way.
    • discuss.answer
      • 41653
      • 18 Posts
      Hi Ottogal, Frogabog, Susan and anyone else.

      I think it's time for a summary otherwise I may end up chasing my own tail.

      1) This worked:

      [[Wayfinder? &startId=`19` &outerClass=`bul-vmenu` ]]

      The 'Left Menu Documents' was item 19.

      The menu displayed correctly. The only downside was that the next level, for example, 'Paintings' menu item opened when clicked and I was asking for it to go nowhere. Not a deal breaker because I can put something on that page but I would have preferred nothing to happen.

      That led on to

      2) Setting the 'Paintings' page link attribute to
      rel="category"

      Making a new chunk called 'categoryFolderTpl'
      Inserting this (corrected) code
      <li[+wf.classes+]><a>[+wf.linktext+]</a>
                   [+wf.wrapper+]
      </li>

      Then adding this to my template (adding my own menu css):
      [[!Wayfinder? &startId=`0` &categoryFoldersTpl=`categoryFolderTpl` &rowTpl=`rowTpl` &innerTpl=`innerTpl` &outerClass=`bul-vmenu`]]

      I got the two containers on the left, so I changed the startId to 19 which lost the containers but also put all the menu items one on top of the other!!

      I have a feeling that I need something in the chunk's properties.
      [ed. note: keithbrook last edited this post 14 years ago.]
      • discuss.answer
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        That is more than likely the CSS. If the CSS was dependent on the a element for styling the menu, then it will be a problem. In such a case, enclose it in a span element instead of an a element, and modify the CSS directive accordingly.
          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
        • discuss.answer
          • 41653
          • 18 Posts
          Hi Susan

          Before I go any further, what was your note about the categoryFolderTpl chunk's properties?

          I think there was an extra step to do with name and value in the Property section of the chunk.

          xxxx

          Keith
          • discuss.answer
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Perhaps I meant the snippet, not the chunk?
              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
            • discuss.answer
              • 22427
              • 793 Posts
              On the values of TVs and the @INHERIT binding


              There are three ways to fetch the value of a TV from within a snippet.
              First you need the TV as an object, and the id of the actual resource:
              $tv = $modx->getObject('modTemplateVar',array('name'=>'tvName'));
              $res_id = $modx->resource->get('id')

              This code gets the raw value of the TV:
              $rawval = $tv->getValue($res_id);

              This code gets the rendered output of the TV:
              $rendered = $tv->renderOutput($res_id);

              A shorter form to get the rendered output is:
              $value = $modx->resource->getTVValue('tvName');
              or
              $value = $modx->resource->getTVValue($tvId);
              if $tvId is the ID of the TV in the Elements tree.

              Assume a TV of
              - Input type Checkbox
              - Input Option Values 1||2
              - Default Value @INHERIT
              - Output type Delimiter with Delimiter , (comma).

              and assume these resources:
              Main Page
                |__Sub Page
              using the same template the TV is assigned to.

              Then you will get these results:

              Checked boxes | Raw TV value | Rendered TV value | Raw TV value | Rendered TV value 
              on Main Page  | on Main Page | on Main Page      | on Sub Page  | on Sub Page 
              
              none            @INHERIT       empty string        @INHERIT       empty string
              1               1              1                   @INHERIT       1	
              2               2              2                   @INHERIT       2
              1 and 2         1||2           1,2                 @INHERIT       1,2


              Editing the Sub Page, if you change the Checkboxes on the TVs tab, the new value will override the inherited value. If you set them back to the inherited value, the Raw value will switch back to @INHERIT again.
                • 41653
                • 18 Posts
                Hi

                Well, I'm not sure what's going on but I saw a post by Ottogal with something about @INHERIT and numbers in a table, but now it's gone.

                I regret to say that I'm not going to pursue this any longer. It's way over my head and all I really want is a simple CMS.

                My appreciation to Ottogal and Frogabog for their patience and persistence with this stupid Brit.

                Thanks also to Susan for her help.

                If you look at this thread, there's all sorts of posts missing or in the wrong order and I just can't get my head around it.

                Nazdrave (as we say in Bulgaria)

                Keith
                  • 22427
                  • 793 Posts
                  Hi Keith,
                  If you look at this thread, there's all sorts of posts missing or in the wrong order and I just can't get my head around it.
                  Yes, there is a strange behaviour of the forum, don't understand how it comes.
                  My last post was indeed for the sidestep branch of the discussion - sorry for that.

                  To your problem: I am a bit at the end of my wisdom. Normally all what was said about Wayfinder menus would work. My impression is that already your original HTML site is rather complex, f.i. depending on Javascripts we don't know. To change the tree structure might have had unwanted side effects.

                  When I find the time, I will again think over it. Don't hesitate to continue to ask for help, if you are not too frustrated. I'm convinced that you would not have less problems if you used another CMS.