If you want to delete files by pattern (e.g. “*.txt”) in a directory, you can do this with the php function glob! [php]$files = glob(‘/path/to/files/*.txt’); // finds all txt files in the directory /path/to/files/ foreach($files as $file) unlink($file);[/php] With this method you can also delete all files of a directory – with pattern *.*
PHP – Delete all files in a directory
Simple question – simple answer: How do I delete all files in a directory with PHP? [php]$files = glob(‘/path/to/directory/*.*’); foreach($files as $file) unlink($file);[/php]
Client localisation with zend framework
If you want to find out the language or country of the clients browser, do it this way: [php]<?php require_once ‘Zend/Locale.php’; $locale = new Zend_Locale(); echo $locale->toString(); ?>[/php] But be aware! This way you only get the localisation of the clients browser. And this is configurable by the user. The code above will give you output like this: [text]de_AT[/text] or …
Magento: Warning in Mage/Eav/Model/Entity/Abstract.php ?
All you want to do is saving a product like this? [php]$api = new Mage_Catalog_Model_Product_Api(); $productData = array(); $productData[‘visibility’] = Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE; $productData[‘status’] = Mage_Catalog_Model_Product_Status::STATUS_DISABLED; $api->update($product->getId(), $productData);[/php] Or maybe without the API? [php]$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE); $product->setStatus(Mage_Catalog_Model_Product_Status::STATUS_DISABLED); $product->save();[/php] And all you get is an error like this? [text]Warning: Invalid argument supplied for foreach() in /opt/lampp/htdocs/whlid/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 972 #0 /opt/lampp/htdocs/whlid/app/code/core/Mage/Eav/Model/Entity/Abstract.php(972): mageCoreErrorHandler(2, ‘Invalid argumen…’, ‘/opt/lampp/htdo…’, …
Hallo Welt!
Meine alte Homepage, die ich mit typo3 umgesetzt hatte, gehört der Vergangenheit an. Diese Version wurde mit WordPress 2.8 erstellt. Funktioniert tadellos.
- Page 2 of 2
- 1
- 2