We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17162
    • 27 Posts
    Hello,

    I am trying to make section of the site I’m currently working on to show the program of the local cinema. Each film is scheduled on 3 or 4 dates/times (Is my explanation clear? huh)

    So, here is my idea:
    I made container page "Films" with child pages for each film (with few TVs about film - actors, description etc) and I made another container page "Program" with pages where dates and times are listed - for each film there is few "program pages".
    On main "cinema" page I would like to list all films from "Film" container (using ditto), and on side bar I would like to put calendar (DittoCal?) which has links to "program pages" for each day. How to include TVs from related "film pages" on "program pages" and maybe dates/times (from "program pages") on "film pages" for each film? Am I clear at all huh ?

    Is it possible using getTemplateVarOutput huh and how?
    I searched forum and find interesting topic http://modxcms.com/forums/index.php?topic=26866.0 but it doesn’t work for me.

    Could anyone help me or point me in right direction where to start?

    Thank you very much,
    Lina
      • 11206
      • 73 Posts
              $page_id = $modx->documentObject['id']; // this will get the id of the current page.
      	$children = $modx->getDocumentChildren($page_id,1,0,"*",""); //will get the children of the page passed with $page_id
      	
      	
      	foreach($children as $key => $value){ // will cycle through the children 
      		$child_tv = $modx->getTemplateVarOutput('*',$value['id'],"1");  // array with TV's.
              }
      


      hope that helps.
        • 17162
        • 27 Posts
        Thank you, Grahoom. Actually, it did help me. smiley I’m working on it.

        Lina
          • 6726
          • 7,075 Posts
          You can also use GetField

          Example :

          [tt][!GetField? &docid=`12` &field=`mytv`!][/tt]

          Of course you can use dynamic ID for docid, but you could also use the &parent, &parentLevel, &topid parameters (check the snippet doc).

          If you’re into PHx, you can also use PHx custom modifier docfield (see http://wiki.modxcms.com/index.php/PHx/CustomModifiers) :

          [tt][+docid:docfield=`field`+][/tt]
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l'outil id