In my previous post, MODX (at) Bindings, @EVAL I took a look at MODx Bindings and I promised a series of posts on each of the five types of data source bindings available to all template variables.

I thought it was really interesting that this week in my comments section for Create a Dynamic CSS File in MODx the topic of @INHERIT came up.

As it states on the MODx SVN:

The @INHERIT binding will automatically find the value of the parent Resource and use that as its value. If the parent Resource also has @INHERIT, it will look at that parent’s parent’s value, and so forth. If it ends up at the root and no value has been specified, the value will be 0.

Example

INHERIT (at) BindingI am currently building a site that has different header images depending on which section of the site you are located. To make this happen I created a text Template Variable (TV) and set the Default Value to @INHERIT. Next, a TV call is placed in the appropriate location of my HTML [*myTV*]. I then set a different image pathway into the TV of each of the first level container documents. At this stage of the game each of my site sections now possesses a unique header image which is being inherited from the ultimate parent of each section.

Now, let’s say I want a solitary header image on my Directions page which is located deep in my Contact Us section. I just go down to that page and it’s TV and enter the new pathway to my Directions image. Now, this page will have it’s own, unique header image.

The function of this binding is pretty straightforward, but it can be very useful. What I have found is that it tends to offer a straightforward approach for meeting design requirements that would otherwise require more complex solutions.

  • buddyrigotti

    I'm sure I'll have a need for this one day. Thanks!

  • http://www.facebook.com/profile.php?id=745570198 Jason Imani

    Interesting….I hadn't thought of using the inherit binding this way…very cool.

  • Aaron Ladage

    Great post! I think @INHERIT bindings are often overlooked, but extremely useful (I know I forget about them all the time).

  • Cyril

    I,

    Havez you tried to use @INHERIT with radiobutton instead of text type for the tv ?
    Actually, i'ts look like it's not working…

    I let you know if it's a config problem,

    Thx for the answer if you know !

  • http://www.gregorysmart.com Gregory Smart

    I believe it only works for text type.

    Thanks, Greg.

    Greg Smart
    Project Manager
    Pleth, LLC
    1-888-276-0848

  • Cyril

    Hi,

    Right, i change for text type and it's working.

    If you put a radio-button with “yes” or “no” value, you will save the value in each herited pages…

  • http://www.cheap-nikeshox.com/nike-shox-R5-women.html shox turbo

    Well , the view of the passage is totally correct ,your details is really reasonable and spring-bags.com you guy give us valuable informative post, I totally agree the standpoint of upstairs. I often surfing on this forum when I m free and I find there are so much good information we can learn in this forum!

  • http://www.nikemaxsale.com nike air max

    “your details is really reasonable and unique I very concerned about sports and I imogen-heap believe only sports can make you energetic. I want to buy some sports thing ,will you give some suggestions nike air max for me from below websites ?

  • http://vibram4u.com/ moncler outlet store

    Hhe article's content rich variety which make us move for our mood after reading this article. surprise, here you will find what you want! Recently, I found <a href=” http://lost-or-stolen.net/ ” >wslmart.net some wedsites which commodity is colorful of fashion. Such as xxxxxxxx that worth you to see. Believe me these websites won’t let you down.

  • Alex

    It actually does work for radio buttons, the only thing is that the selection itself in the manager wont change, but the @INHERIT works for child docs.