search
top

Directory paths in Magento

Hello All, I am writing here the code to get various base directory paths, which might be useful. Assuming the directory is named ‘magento’ where your site is present and its the root directory of the filesystem. echo Mage::getBaseDir('base'); magento echo Mage::getBaseDir('app'); magento/app echo Mage::getBaseDir('code'); magento/app/code echo Mage::getModel('core/config')->getOptions()->getCodeDir(); magento/app/code echo...
read more

Delete Directory in PHP

This post will be helpful to those who work with directories and files. I am writing here the PHP code for deleting the directory. <?php $extract_dir = 'path'; //physical path of the directory if(deleteDirectory($extract_dir)) //delete directory { $msg = "$extract_dir was deleted"; echo $msg."<br/>"; } else { $msg = "$extract_dir was not deleted"; echo...
read more

Page Redirect

I have written a script for getting the files list from directory and redirecting the page on selecting option from the select box. So you will get the script for fetching all the files from current directory and redirecting page on selection. <h>Please select option</h> <?php $path = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI']; //current directory physical path $dir_handle...
read more

Copy Directory

I am listing here the method to copy full Directories with all sub-directories and files. <?php $source = 'f1'; //folder name $target = 'f2'; //folder name , if target folder does not exists, it will be created //echo 'src->'.$source.'<br/>'; //echo 'tar->'.$target.'<br/>'; if(is_dir($source)) { full_copy($source,$target); echo 'Folder copied'; } else { echo...
read more

top