references:joomla.framework:filesystem:jfolder-createcreate
Creates a folder and all necessary parent folders. Thus, if invoked to create a folder called ‘level1/level2/level3/newfolder’ it will create the ‘level1’, ‘level2’ and ‘level3’ folders if they do not exist and will then create the ‘newfolder’ folder. If safe mode is enabled, FTP will be used to create the folder (if it is enabled). This method will not create a folder if the ‘open_basedir’ parameter is set and the specified folder is not in the allowed base folder. This function returns true on success, false otherwise. Syntaxboolean create ( $path, $mode )
ExamplesExample jimport( 'joomla.filesystem.folder' ); if (JFolder::create( 'test2/test' )) { echo "Folder successfully created!"; } else { echo "Folder creation failed!"; } might produce: Result Folder successfully created! DiscussionDan3000, 2006/04/30 11:27: “folder” folder ??? a bit confusing? changed it Dan3000, 2006/04/30 11:28: what does this piece of code do? jimport( ‘joomla.filesystem.folder’ ) chrisdavenport, 2006/05/02 11:58: jimport is a function which calls JLoader, the ‘smart’ class loader. It is defined in libraries/loader.php. Without it you would get an ‘undefined class’ error when you tried to call JFolder::create. |


