public function pathId($Path)
	{
		$Path = "root" . $Path;

		if ($Path [strlen ( $Path ) - 1] == "/")
			$Path = substr ( $Path, 0, strlen ( $Path ) - 1 );
		$Parts = explode ( "/", $Path );

		$Adapter = get_class(Jf::$Db);
		if ($Adapter == "mysqli" or ($Adapter == "PDO" and Jf::$Db->getAttribute(PDO::ATTR_DRIVER_NAME)=="mysql")) {
			$GroupConcat="GROUP_CONCAT(parent.Title ORDER BY parent.Lft SEPARATOR '/')";
		} elseif ($Adapter == "PDO" and Jf::$Db->getAttribute(PDO::ATTR_DRIVER_NAME)=="sqlite") {
			$GroupConcat="GROUP_CONCAT(parent.Title,'/')";
		} else {
			throw new \Exception ("Unknown Group_Concat on this type of database: {$Adapter}");
		}

		$res = Jf::sql ( "SELECT node.ID,{$GroupConcat} AS Path
				FROM {$this->tablePrefix()}{$this->type()} AS node,
				{$this->tablePrefix()}{$this->type()} AS parent
				WHERE node.Lft BETWEEN parent.Lft AND parent.Rght
				AND  node.Title=?
				GROUP BY node.ID
				HAVING Path = ?
				", $Parts [count ( $Parts ) - 1], $Path );

		if ($res)
			return $res [0] ['ID'];
		else
			return null;
			// TODO: make the below SQL work, so that 1024 limit is over

		$QueryBase = ("SELECT n0.ID  \nFROM {$this->tablePrefix()}{$this->type()} AS n0");
		$QueryCondition = "\nWHERE 	n0.Title=?";

		for($i = 1; $i < count ( $Parts ); ++ $i)
		{
			$j = $i - 1;
			$QueryBase .= "\nJOIN 		{$this->tablePrefix()}{$this->type()} AS n{$i} ON (n{$j}.Lft BETWEEN n{$i}.Lft+1 AND n{$i}.Rght)";
			$QueryCondition .= "\nAND 	n{$i}.Title=?";
			// Forcing middle elements
			$QueryBase .= "\nLEFT JOIN 	{$this->tablePrefix()}{$this->type()} AS nn{$i} ON (nn{$i}.Lft BETWEEN n{$i}.Lft+1 AND n{$j}.Lft-1)";
			$QueryCondition .= "\nAND 	nn{$i}.Lft IS NULL";
		}
		$Query = $QueryBase . $QueryCondition;
		$PartsRev = array_reverse ( $Parts );
		array_unshift ( $PartsRev, $Query );

		print_ ( $PartsRev );
		$res = call_user_func_array ( "Jf::sql", $PartsRev );

		if ($res)
			return $res [0] ['ID'];
		else
			return null;
	}
public function pathId($Path)
	{
		$Path = "root" . $Path;

		if ($Path [strlen ( $Path ) - 1] == "/")
			$Path = substr ( $Path, 0, strlen ( $Path ) - 1 );
		$Parts = explode ( "/", $Path );

		$Adapter = get_class(Jf::$Db);
		if ($Adapter == "mysqli" or ($Adapter == "PDO" and Jf::$Db->getAttribute(PDO::ATTR_DRIVER_NAME)=="mysql")) {
			$GroupConcat="GROUP_CONCAT(parent.Title ORDER BY parent.Lft SEPARATOR '/')";
		} elseif ($Adapter == "PDO" and Jf::$Db->getAttribute(PDO::ATTR_DRIVER_NAME)=="sqlite") {
			$GroupConcat="GROUP_CONCAT(parent.Title,'/')";
		} else {
			throw new \Exception ("Unknown Group_Concat on this type of database: {$Adapter}");
		}

		$res = Jf::sql ( "SELECT node.ID,{$GroupConcat} AS Path
				FROM {$this->tablePrefix()}{$this->type()} AS node,
				{$this->tablePrefix()}{$this->type()} AS parent
				WHERE node.Lft BETWEEN parent.Lft AND parent.Rght
				AND  node.Title=?
				GROUP BY node.ID
				HAVING Path = ?
				", $Parts [count ( $Parts ) - 1], $Path );

		if ($res)
			return $res [0] ['ID'];
		else
			return null;
			// TODO: make the below SQL work, so that 1024 limit is over

		$QueryBase = ("SELECT n0.ID  \nFROM {$this->tablePrefix()}{$this->type()} AS n0");
		$QueryCondition = "\nWHERE 	n0.Title=?";

		for($i = 1; $i < count ( $Parts ); ++ $i)
		{
			$j = $i - 1;
			$QueryBase .= "\nJOIN 		{$this->tablePrefix()}{$this->type()} AS n{$i} ON (n{$j}.Lft BETWEEN n{$i}.Lft+1 AND n{$i}.Rght)";
			$QueryCondition .= "\nAND 	n{$i}.Title=?";
			// Forcing middle elements
			$QueryBase .= "\nLEFT JOIN 	{$this->tablePrefix()}{$this->type()} AS nn{$i} ON (nn{$i}.Lft BETWEEN n{$i}.Lft+1 AND n{$j}.Lft-1)";
			$QueryCondition .= "\nAND 	nn{$i}.Lft IS NULL";
		}
		$Query = $QueryBase . $QueryCondition;
		$PartsRev = array_reverse ( $Parts );
		array_unshift ( $PartsRev, $Query );

		print_ ( $PartsRev );
		$res = call_user_func_array ( "Jf::sql", $PartsRev );

		if ($res)
			return $res [0] ['ID'];
		else
			return null;
	}
public function pathId ( $ Path ) { $ Path = "root" . $ Path ; if ( $ Path [ strlen ( $ Path ) - 1 ] == "/" ) $ Path = substr ( $ Path , 0 , strlen ( $ Path ) - 1 ) ; $ Parts = explode ( "/" , $ Path ) ; $ Adapter = get_class ( Jf :: $ Db ) ; if ( $ Adapter == "mysqli" or ( $ Adapter == "PDO" and Jf :: $ Db -> getAttribute ( PDO :: ATTR_DRIVER_NAME ) == "mysql" ) ) { $ GroupConcat = "GROUP_CONCAT(parent.Title ORDER BY parent.Lft SEPARATOR '/')" ; } elseif ( $ Adapter == "PDO" and Jf :: $ Db -> getAttribute ( PDO :: ATTR_DRIVER_NAME ) == "sqlite" ) { $ GroupConcat = "GROUP_CONCAT(parent.Title,'/')" ; } else { throw new \ Exception ( "Unknown Group_Concat on this type of database: {$Adapter}" ) ; } $ res = Jf :: sql ( "SELECT node.ID,{$GroupConcat} AS Path
				FROM {$this->tablePrefix()}{$this->type()} AS node,
				{$this->tablePrefix()}{$this->type()} AS parent
				WHERE node.Lft BETWEEN parent.Lft AND parent.Rght
				AND  node.Title=?
				GROUP BY node.ID
				HAVING Path = ?
				" , $ Parts [ count ( $ Parts ) - 1 ] , $ Path ) ; if ( $ res ) return $ res [ 0 ] [ 'ID' ] ; else return null ; // TODO: make the below SQL work, so that 1024 limit is over $ QueryBase = ( "SELECT n0.ID  \nFROM {$this->tablePrefix()}{$this->type()} AS n0" ) ; $ QueryCondition = "\nWHERE 	n0.Title=?" ; for ( $ i = 1 ; $ i < count ( $ Parts ) ; ++ $ i ) { $ j = $ i - 1 ; $ QueryBase .= "\nJOIN 		{$this->tablePrefix()}{$this->type()} AS n{$i} ON (n{$j}.Lft BETWEEN n{$i}.Lft+1 AND n{$i}.Rght)" ; $ QueryCondition .= "\nAND 	n{$i}.Title=?" ; // Forcing middle elements $ QueryBase .= "\nLEFT JOIN 	{$this->tablePrefix()}{$this->type()} AS nn{$i} ON (nn{$i}.Lft BETWEEN n{$i}.Lft+1 AND n{$j}.Lft-1)" ; $ QueryCondition .= "\nAND 	nn{$i}.Lft IS NULL" ; } $ Query = $ QueryBase . $ QueryCondition ; $ PartsRev = array_reverse ( $ Parts ) ; array_unshift ( $ PartsRev , $ Query ) ; print_ ( $ PartsRev ) ; $ res = call_user_func_array ( "Jf::sql" , $ PartsRev ) ; if ( $ res ) return $ res [ 0 ] [ 'ID' ] ; else return null ; }
Returns ID of a path

@todo this has a limit of 1000 characters on $Path
@param string $Path
such as /role1/role2/role3 ( a single slash is root)
@return integer NULL
Returns ID of a path