Monday, April 26, 2010

how to clean the url in php?

Hi
 This is the code for remove the unwanted charecter from the uploaded file

 $_FILES['image']['name'] = strtolower(trim($_FILES['image']['name']));
                 $_FILES['image']['name'] = str_replace(array('\'',' ','\#','\$','\&','\!','\@','\#','\$','\%','\^','\&','\*','\(','\)','\_',
              '\+','\{','\}'),'', $_FILES['image']['name']);



have dream day

Friday, April 23, 2010

Zend Framework Tutorials

1.first set the bootstrap

 protected function _initAppAutoload()
    {
        $moduleLoad = new Zend_Application_Module_Autoloader(array(
           'namespace' => '',
           'basePath'   => APPLICATION_PATH
        ));
    }


2.set up the database connection in another class file or config.ini
  first write code in ini file
   [general]
 db.adapter = PDO_MYSQL
 db.config.host = localhost
 db.config.user = root
 db.config.password = password
 db.config.dbname = zend


  then in public index.php write code
  
$config =new Zend_Config_Ini(APPLICATION_PATH.'/configs/application.ini','general');
Zend_Registry::set('config',$config);
//database
$db = Zend_Db::factory($config->db->adapter,$config->db->config->toArray());
Zend_Db_Table::setDefaultAdapter($db);


3.create the class in model and give the name of the table

Zend Framework,bootstrap file autoload

Hi,
 If you want to access the any model or other class then in application folder,the you must auto load the class in bootstrap file,and write the code below

  protected function _initAppAutoload()
    {
        $moduleLoad = new Zend_Application_Module_Autoloader(array(
           'namespace' => '',
           'basePath'   => APPLICATION_PATH
        ));
    }


Have Dream Day