We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21257 MODX Staff
    • 730 Posts
    In case anyone has time to attempt a fix/workaround for WayFinder, it looks to me like line 416 of wayfinder.inc.php is where the document’s TV values are gathered. To get @INHERIT to work in these cases, I think you would have to check to see if the TV’s value is @INHERIT, and if so, do the actual (intended) inheriting right there.
      Mike Schell
      Lead Developer, MODX Cloud
      Email: [email protected]
      GitHub: https://github.com/netProphET/
      Twitter: @mkschell
      • 31290
      • 37 Posts
      Seems like we are on the right track here. OpenGeek’s description of the problem is exactly what I am experiencing.

      PS: I am very excited for Revolution!
        • 4309
        • 4 Posts
        I have a fix for this grin
        The row parser works fine with tv’s, it is just the outer and inner wrapper parser that isn’t replacing them.
        Apply netProphET’s Ditto fix. The code for this function is exactly the same as wayfinder.
        Quote from: netProphET at Aug 29, 2008, 01:05 PM

        I submitted a change to fix this problem in Ditto a couple of months ago.
        http://mirror3.cvsdude.com/trac/ditto/codebase/ticket/84
        It’s only a partial fix, but solves a certain class of problems for me. And sorry it’s not a Wayfinder fix. I wonder if something similar could be done for WF?

        Then, change the following lines to correct the wrapper parser.
        Around Line 126
        			//Process the wrapper
        			if (!empty($this->tvList)) {
        				$usePlaceholders = array_merge($this->placeHolders['wrapperLevel'],$this->placeHolders['tvs']);
        				foreach ($this->tvList as $tvName) {
        					$phArray[] = $docInfo[$tvName];
        				}
        			}
        			else {
        				$usePlaceholders = $this->placeHolders['wrapperLevel'];
        			}
        			
        			
        			$subMenuOutput = str_replace($usePlaceholders,$phArray,$useChunk);
        
          currently working on a peer2php application
          • 15987
          • 786 Posts
          bungo, do you have the code for this. I would like to get the fix put into the next version of wayfinder, but the trac link no longer works.

          Thanks in advance.

          Kyle
            • 4309
            • 4 Posts
            Yes, I use SVN. I will attach? a patch.
              currently working on a peer2php application
              • 15987
              • 786 Posts
              That would be great.
                • 4309
                • 4 Posts
                Just had to get into work.
                I have attached a diff of the Wayfinder from 9.6.3, with my changes, and also posted them below.

                Here is the modified function with the change from Ditto. My changes in the previous post allow TV replacement in the wrapper as well.

                	function appendTV($tvname,$docIDs){
                		global $modx;
                		
                		$baspath= $modx->config["base_path"] . "manager/includes";
                	    include_once $baspath . "/tmplvars.format.inc.php";
                	    include_once $baspath . "/tmplvars.commands.inc.php";
                
                		$tb1 = $modx->getFullTableName("site_tmplvar_contentvalues");
                		$tb2 = $modx->getFullTableName("site_tmplvars");
                
                		$query = "SELECT stv.name,stc.tmplvarid,stc.contentid,stv.type,stv.display,stv.display_params,stc.value";
                		$query .= " FROM ".$tb1." stc LEFT JOIN ".$tb2." stv ON stv.id=stc.tmplvarid ";
                		$query .= " WHERE stv.name='".$tvname."' AND stc.contentid IN (".implode($docIDs,",").") ORDER BY stc.contentid ASC;";
                		$rs = $modx->db->query($query);
                		$tot = $modx->db->getRecordCount($rs);
                		$resourceArray = array();
                		for($i=0;$i<$tot;$i++)  {
                			$row = @$modx->fetchRow($rs);
                			$resourceArray["#{$row['contentid']}"][$row['name']] = getTVDisplayFormat($row['name'], $row['value'], $row['display'], $row['display_params'], $row['type'],$row['contentid']);   
                		}
                
                		//new code direct from ditto
                			if ($tot != count($docIDs)) {
                			$query = "SELECT name,type,display,display_params,default_text";
                			$query .= " FROM $tb2";
                			$query .= " WHERE name='".$tvname."' LIMIT 1";
                			$rs = $modx->db->query($query);
                			$row = @$modx->fetchRow($rs);
                			foreach ($docIDs as $id) {
                				$defaultOutput = getTVDisplayFormat($row['name'], $row['default_text'], $row['display'], $row['display_params'], $row['type'],$id);
                				if (!isset($resourceArray["#".$id])) {
                					$resourceArray["#{$id}"][$tvname] = $defaultOutput;
                					//$resourceArray["#$id"]["tv".$tvname] = $resourceArray["#$id"][$tvname];
                				}
                			}
                		}
                		return $resourceArray;
                	}
                
                  currently working on a peer2php application
                  • 6659
                  • 18 Posts
                  After speaking to netProphET and hacking around with the code, I’ve made similar changes to Ditto and Wayfinder and got @INHERIT working for both. Code is here.