library/core/class.module.php
public function FetchViewLocation($View = '', $ApplicationFolder = '') {
      if ($View == '')
         $View = strtolower($this->Name());
         
      if (substr($View, -6) == 'module')
         $View = substr($View, 0, -6);
               
      if (substr($View, 0, 4) == 'gdn_')
         $View = substr($View, 4);

      if ($ApplicationFolder == '')
         $ApplicationFolder = strpos($this->_ApplicationFolder, '/') ? $this->_ApplicationFolder : strtolower($this->_ApplicationFolder);

      $ThemeFolder = $this->_ThemeFolder;
      
      $ViewPath = NULL;
      
      // Try to use Gdn_Controller's FetchViewLocation
      if (Gdn::Controller() instanceof Gdn_Controller) {
         try {
            $ViewPath = Gdn::Controller()->FetchViewLocation($View, 'modules', $ApplicationFolder);
         } catch (Exception $Ex) {}
      }
      
      if (!$ViewPath) {
         
         $ViewPaths = array();
         // 1. An explicitly defined path to a view
         if (strpos($View, '/') !== FALSE)
            $ViewPaths[] = $View;

         // 2. A theme
         if ($ThemeFolder != '') {
            // a. Application-specific theme view. eg. /path/to/application/themes/theme_name/app_name/views/modules/
            $ViewPaths[] = CombinePaths(array(PATH_THEMES, $ThemeFolder, $ApplicationFolder, 'views', 'modules', $View . '.php'));
            
            // b. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/modules/
            $ViewPaths[] = CombinePaths(array(PATH_THEMES, $ThemeFolder, 'views', 'modules', $View . '.php'));
         }

         // 3. Application default. eg. /path/to/application/app_name/views/controller_name/
         if ($this->_ApplicationFolder)
            $ViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, $ApplicationFolder, 'views', 'modules', $View . '.php'));
         else
            $ViewPaths[] = dirname($this->Path())."/../views/modules/$View.php";

         // 4. Garden default. eg. /path/to/application/dashboard/views/modules/
         $ViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, 'dashboard', 'views', 'modules', $View . '.php'));

         $ViewPath = Gdn_FileSystem::Exists($ViewPaths);
      }
      
      if ($ViewPath === FALSE)
         throw new Exception(ErrorMessage('Could not find a `' . $View . '` view for the `' . $this->Name() . '` module in the `' . $ApplicationFolder . '` application.', get_class($this), 'FetchView'), E_USER_ERROR);

      return $ViewPath;
   }
public function FetchViewLocation($View = '', $ApplicationFolder = '') {
      if ($View == '')
         $View = strtolower($this->Name());
         
      if (substr($View, -6) == 'module')
         $View = substr($View, 0, -6);
               
      if (substr($View, 0, 4) == 'gdn_')
         $View = substr($View, 4);

      if ($ApplicationFolder == '')
         $ApplicationFolder = strpos($this->_ApplicationFolder, '/') ? $this->_ApplicationFolder : strtolower($this->_ApplicationFolder);

      $ThemeFolder = $this->_ThemeFolder;
      
      $ViewPath = NULL;
      
      // Try to use Gdn_Controller's FetchViewLocation
      if (Gdn::Controller() instanceof Gdn_Controller) {
         try {
            $ViewPath = Gdn::Controller()->FetchViewLocation($View, 'modules', $ApplicationFolder);
         } catch (Exception $Ex) {}
      }
      
      if (!$ViewPath) {
         
         $ViewPaths = array();
         // 1. An explicitly defined path to a view
         if (strpos($View, '/') !== FALSE)
            $ViewPaths[] = $View;

         // 2. A theme
         if ($ThemeFolder != '') {
            // a. Application-specific theme view. eg. /path/to/application/themes/theme_name/app_name/views/modules/
            $ViewPaths[] = CombinePaths(array(PATH_THEMES, $ThemeFolder, $ApplicationFolder, 'views', 'modules', $View . '.php'));
            
            // b. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/modules/
            $ViewPaths[] = CombinePaths(array(PATH_THEMES, $ThemeFolder, 'views', 'modules', $View . '.php'));
         }

         // 3. Application default. eg. /path/to/application/app_name/views/controller_name/
         if ($this->_ApplicationFolder)
            $ViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, $ApplicationFolder, 'views', 'modules', $View . '.php'));
         else
            $ViewPaths[] = dirname($this->Path())."/../views/modules/$View.php";

         // 4. Garden default. eg. /path/to/application/dashboard/views/modules/
         $ViewPaths[] = CombinePaths(array(PATH_APPLICATIONS, 'dashboard', 'views', 'modules', $View . '.php'));

         $ViewPath = Gdn_FileSystem::Exists($ViewPaths);
      }
      
      if ($ViewPath === FALSE)
         throw new Exception(ErrorMessage('Could not find a `' . $View . '` view for the `' . $this->Name() . '` module in the `' . $ApplicationFolder . '` application.', get_class($this), 'FetchView'), E_USER_ERROR);

      return $ViewPath;
   }
public function FetchViewLocation ( $ View = '' , $ ApplicationFolder = '' ) { if ( $ View == '' ) $ View = strtolower ( $ this -> Name ( ) ) ; if ( substr ( $ View , - 6 ) == 'module' ) $ View = substr ( $ View , 0 , - 6 ) ; if ( substr ( $ View , 0 , 4 ) == 'gdn_' ) $ View = substr ( $ View , 4 ) ; if ( $ ApplicationFolder == '' ) $ ApplicationFolder = strpos ( $ this -> _ApplicationFolder , '/' ) ? $ this -> _ApplicationFolder : strtolower ( $ this -> _ApplicationFolder ) ; $ ThemeFolder = $ this -> _ThemeFolder ; $ ViewPath = NULL ; // Try to use Gdn_Controller's FetchViewLocation if ( Gdn :: Controller ( ) instanceof Gdn_Controller ) { try { $ ViewPath = Gdn :: Controller ( ) -> FetchViewLocation ( $ View , 'modules' , $ ApplicationFolder ) ; } catch ( Exception $ Ex ) { } } if ( ! $ ViewPath ) { $ ViewPaths = array ( ) ; // 1. An explicitly defined path to a view if ( strpos ( $ View , '/' ) !== FALSE ) $ ViewPaths [ ] = $ View ; // 2. A theme if ( $ ThemeFolder != '' ) { // a. Application-specific theme view. eg. /path/to/application/themes/theme_name/app_name/views/modules/ $ ViewPaths [ ] = CombinePaths ( array ( PATH_THEMES , $ ThemeFolder , $ ApplicationFolder , 'views' , 'modules' , $ View . '.php' ) ) ; // b. Garden-wide theme view. eg. /path/to/application/themes/theme_name/views/modules/ $ ViewPaths [ ] = CombinePaths ( array ( PATH_THEMES , $ ThemeFolder , 'views' , 'modules' , $ View . '.php' ) ) ; } // 3. Application default. eg. /path/to/application/app_name/views/controller_name/ if ( $ this -> _ApplicationFolder ) $ ViewPaths [ ] = CombinePaths ( array ( PATH_APPLICATIONS , $ ApplicationFolder , 'views' , 'modules' , $ View . '.php' ) ) ; else $ ViewPaths [ ] = dirname ( $ this -> Path ( ) ) . "/../views/modules/$View.php" ; // 4. Garden default. eg. /path/to/application/dashboard/views/modules/ $ ViewPaths [ ] = CombinePaths ( array ( PATH_APPLICATIONS , 'dashboard' , 'views' , 'modules' , $ View . '.php' ) ) ; $ ViewPath = Gdn_FileSystem :: Exists ( $ ViewPaths ) ; } if ( $ ViewPath === FALSE ) throw new Exception ( ErrorMessage ( 'Could not find a `' . $ View . '` view for the `' . $ this -> Name ( ) . '` module in the `' . $ ApplicationFolder . '` application.' , get_class ( $ this ) , 'FetchView' ) , E_USER_ERROR ) ; return $ ViewPath ; }
Returns the location of the view for this module in the filesystem.

@param string $View
@param string $ApplicationFolder
@return array
Returns the location of the view for this module in the filesystem .