php file system read all file in directory class

[php] class readd_all_file{ function __construct() { $this->index(); } function index(){ $this->all_pic=array(); $dir_name="images"; $this->open_dir($dir_name); $this->dbg2($this->all_pic); } function open_dir($dir_name){ $IMAGES_fold=scandir($dir_name); foreach($IMAGES_fold as $fold){ if(in_array($fold,array(".",".."))){continue;} if(!is_dir($dir_name."/".$fold)){ $this->all_pic[]=$dir_name."/".$fold; }else{ $this->open_dir($dir_name."/".$fold); } } } } [/php] [14] => images/Buttons/1320202803_button.png [15] => images/Buttons/1320203926_button.png [16] => images/Buttons/1320203948_button.png [17] => images/Buttons/1320203966_button.png [18] => images/Buttons/1337051437_button.png [19] => images/Buttons/1337051451_button.png [20] => images/Buttons/mcith/mcith_1320202803_button.png [21] => images/Buttons/mcith/mcith_1320203926_button.png [22] => images/Buttons/mcith/mcith_1320203948_button.png [23] => images/Buttons/mcith/mcith_1320203966_button.png [24] => images/Buttons/mcith/mcith_1337051437_button.png [25] => images/Buttons/mcith/mcith_1337051451_button.png [26] => images/Buttons/mcith/mcith_tukendi_buton.png [27] => images/Buttons/mcith/mcith_tukendi_buton_en.png [28] => images/Buttons/mcith/mcith_yeni_buton.png [29] => images/Buttons/mcith/mcith_yeni_buton_en.png [30] => images/Buttons/refrsh.jpeg [31] => images/Buttons/tukendi_buton.png [32] => images/Buttons/tukendi_buton_en.png [33] => images/Buttons/yeni_buton.png [34] => images/Buttons/yeni_buton_en.png [35] => images/MiniSlide/1335804630_1.png [36] => images/MiniSlide/1335810909_1.png [37] => images/MiniSlide/1335812296_1.png [38] => images/MiniSlide/1335812377_.jpeg [39] => images/MiniSlide/1335812456_1.png [40] => images/MiniSlide/1335812484_1.png [41] => images/MiniSlide/1335812493_1.png [42] => images/MiniSlide/1335813419_1.png [43] => images/MiniSlide/1335813426_1.png [44] => images/MiniSlide/1335917378_1.png [45] => images/MiniSlide/1335917394_1.png [46] => images/MiniSlide/1336410058_1.gif [47] => images/MiniSlide/1336410066_1.gif [48] => images/MiniSlide/1336410103_1.gif [49] => images/MiniSlide/1336550136_1.jpeg [50] => images/MiniSlide/1336555136_1.jpeg

14/01/2015

objPHPExcel adjust to printing

 $objPHPExcel->getActiveSheet()->getPageSetup()->setFitToPage(true);
[php]

// Set Orientation, size and scaling
 $objPHPExcel->setActiveSheetIndex(0);
 $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
 $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
 $objPHPExcel->getActiveSheet()->getPageSetup()->setFitToPage(true);
 $objPHPExcel->getActiveSheet()->getPageSetup()->setFitToWidth(1);
 $objPHPExcel->getActiveSheet()->getPageSetup()->setFitToHeight(0);

[/php]





----

14/01/2015

ImageWorkshop using php GD to manipulate images

PHP class using GD library to work easily with images as layers (like Photoshop or GIMP) http://phpimageworkshop.com/

14/01/2015

Extending phpmailer

Extending phpmailer (inheritance) Extending classes with inheritance is one of the most powerful features of object-oriented programming. It allows you to make changes to the original class for your own personal use without hacking the original classes. Plus, it is very easy to do. I've provided an example: Here's a class that extends the phpmailer class and sets the defaults for the particular site: PHP include file: mail.inc.php [php] require("phpmailer.inc.php"); class my_phpmailer extends phpmailer { // Set default variables for all new objects var $From = "from@email.com"; var $FromName = "Mailer"; var $Host = "smtp1.site.com;smtp2.site.com"; var $Mailer = "smtp"; var $WordWrap = 75; // Replace the default error_handler function error_handler($msg) { print("My Site Error"); print("Description:"); printf("%s", $msg); exit; } // Create an additional function function do_something($something) { // Place your new code here } } [/php] Now here's a normal PHP page in the site: Normal PHP file: mail_test.php [php]</pre> require("mail.inc.php"); // Instantiate your new class $mail = new my_phpmailer; // Now you only need to add the necessary stuff $mail->AddAddress("josh@site.com", "Josh Adams"); $mail->Subject = "Here is the subject"; $mail->Body = "This is the message body"; $mail->AddAttachment("c:/temp/11-10-00.zip"); $mail->Send(); // send message echo "Message was sent successfully"; [/php]

14/01/2015

Sendin E-mail with PHPMailer Using Gmail Smtp

Sendin E-mail with  PHPMailer Using Gmail Smtp
Sendin E-mail with  PHPMailer Using Gmail Smtp  [php] require_once('../class.phpmailer.php'); //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail             = new PHPMailer(); $body             = file_get_contents('contents.html'); $body             = preg_replace('/[\]/','',$body); $mail->IsSMTP(); // telling the class to use SMTP $mail->Host       = "mail.yourdomain.com"; // SMTP server $mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing) // 1 = errors and messages // 2 = messages only $mail->SMTPAuth   = true;                  // enable SMTP authentication $mail->SMTPSecure = "tls";                 // sets the prefix to the servier $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server $mail->Port       = 587;                   // set the SMTP port for the GMAIL server $mail->Username   = "yourusername@gmail.com";  // GMAIL username $mail->Password   = "yourpassword";            // GMAIL password $mail->SetFrom('name@yourdomain.com', 'First Last'); $mail->AddReplyTo("name@yourdomain.com","First Last"); $mail->Subject    = "PHPMailer Test Subject via smtp (Gmail), basic"; $mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($body); $address = "whoto@otherdomain.com"; $mail->AddAddress($address, "John Doe"); $mail->AddAttachment("images/phpmailer.gif");      // attachment $mail->AddAttachment("images/phpmailer_mini.gif"); // attachment if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; } [/php]

14/01/2015

Formcat, PHP, Smarty plug-in for client side form validation

Formcat is a class for performing form validation on the client side. Its goal is to generate Javascript code to validate forms before they are submited to the server. It works as a plug-in for the Smarty template engine. It is a good complement SmartyValidate plug-in that performs server side validation. It supports many built-in validation criteria: empty, range, length, checkbox, radio button, integer, float, email, credit card, list menu, date, date comparison, equality between fields, file size, file type, custom validator calls. {formcat ...} tags can be located anywhere in the templates, regardless of where the corresponding fields are located in the form. http://www.phpclasses.org/package/2051-PHP-Smarty-plug-in-for-client-side-form-validation.html

14/01/2015

PHPExcel - Formating cell and Number Format

PHPExcel - Formating cell and Number Format

PHPExcel - Formating cell and Number Format  css formating


14/01/2015