mosReadDirectory equivalent for Joomla 1.5 ?
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
- carsten888
- Joomla! Apprentice
- Posts: 27
- Joined: Sat Feb 11, 2006 8:32 am
- Location: Tilburg, Holland
- Contact:
mosReadDirectory equivalent for Joomla 1.5 ?
does anyone know the mosReadDirectory equivalent for Joomla 1.5 ?
Last edited by carsten888 on Fri Mar 21, 2008 3:11 pm, edited 1 time in total.
-
- Joomla! Apprentice
- Posts: 41
- Joined: Sat Dec 15, 2007 3:02 pm
- Location: Washington DC Metro
Re: mosReadDirectory equivalent for Joomla 1.5 ?
Perhaps what you are looking for is in joomla_root/libraries/joomla/filesystem/folder.php ...
or
Code: Select all
/**
* Utility function to read the files in a folder
*
* @param string $path The path of the folder to read
* @param string $filter A filter for file names
* @param mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth
* @param boolean $fullpath True to return the full path to the file
* @param array $exclude Array with names of files which should not be shown in the result
* @return array Files in the given folder
* @since 1.5
*/
function files($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS'))
Code: Select all
/**
* Utility function to read the folders in a folder
*
* @param string $path The path of the folder to read
* @param string $filter A filter for folder names
* @param mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth
* @param boolean $fullpath True to return the full path to the folders
* @param array $exclude Array with names of folders which should not be shown in the result
* @return array Folders in the given folder
* @since 1.5
*/
function folders($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS'))
Denise
- carsten888
- Joomla! Apprentice
- Posts: 27
- Joined: Sat Feb 11, 2006 8:32 am
- Location: Tilburg, Holland
- Contact:
Re: mosReadDirectory equivalent for Joomla 1.5 ?
Thank you! that was what I was looking for.
to read languages from a folder for all versions of Joomla:
I did not test the code for joomla 1.0.x yet.
to read languages from a folder for all versions of Joomla:
Code: Select all
if( defined('_JEXEC') ){
//joomla 1.5
jimport( 'joomla.filesystem.folder' );
$languages = JFolder::files(dirname(__FILE__).'/../language');
}else{
//joomla 1.0.x
$languages = mosReadDirectory(dirname(__FILE__).'/../language');
}
foreach($languages as $language){
if($language!='index.html'){
$language = str_replace('.php','',$language);
$selected = '';
if($language==$config['language']){
$selected = ' selected="selected"';
}
echo '<option value="'.$language.'"'.$selected.'>'.$language.'</option>';
}
}