We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26016
    • 561 Posts
    Hi All,
    These @BINDINGS are extremely handy. @INHERIT is especially good.

    I have a template with a sidebar. I was thinking of how to have a convenient way to edit its content. Something that even a client could do. wink My thought was to simply have a document for that and pull it into the template with @DOCUMENT in a TV. Works great, as you know!

    But how about this... let’s say in one area in your site, you’d like to have the same content in your sidebar for everything in a particular folder. My first thought was that I could have @INHERIT be the default value of the TV, and then put in @DOCUMENT blah-blah in the TV in the highest level document, and I thought it would cascade thru everything under it. But it looks like you can’t use the two together. To put it another way, maybe @BINDINGS cannot inherit each other. I guess that would be like an Escher painting or something.

    One idea is to hard-code the stuff in the template, obviously, but I don’t want that partcular content to be everywhere on the site, just in one folder, and it would be great to use only one template if possible. Or I could just put @DOCUMENT in lots of places, just more work. I’m probably missing some obvious idea, and some smart person will point it out. smiley

    Thanks!!!
      MODx and Wordpress development
      Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
      • 727
      • 502 Posts
      Any ideas on how to get this working?

      I have a TV called "sidebar" with a default value of "@inherit".
      In the parent document the TV value is set to "@document 3".
      In the child document the TV value is either set to nothing or "@inherit".

      When I view the child document the contents of document 3 are not displayed.

      Any ideas? Getting this working would make my latest site much easier for the end user to manage. I’m using 0.9.6.1. Thanks!

      Andy
        • 26016
        • 561 Posts
        Quote from: ganeshXL at Dec 01, 2007, 05:21 AM

        @samba: one solution would be creating a little snippet that basically checks in which folder we are, and depending on the parent either include document x or not.
        pseudo-code:
        if($parentID ==34) {
        $sidebarID=12;
        } else {
        $sidebarID=8;
        }
        return($sidebarID);

        I guess you could then just put that snippet on top of every template and use a TV that EVALs the value. Or maybe even use @DOCUMENT [!getSidebar!]


        Ganesh,
        Very nice creative idea! I appreciate it.

        Thanks again, Samba
          MODx and Wordpress development
          Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
          • 727
          • 502 Posts
          I was coming to the same conclusion. Change the TV to just hold the document number, use @inherit and then use a snippet to perform the function of @document. Hopefully that will work...

          Andy