Using Webform Module we can easily create any Form in Drupal. Using Webform Validation module we can add some pre build validation such as Max length, Min length, Words blacklist, Regular expression, Specific value etc. But these are not enough, some time we need some custom validation to restrict the Webform. In this blog I will give the step by step process how to add custom validation in Webform. Continue reading
Drupal: Create Form using Webform Module
In Drupal, it is very easy to create a Form such as Contact Us Form or Registration Form. No need to create any custom module to create any Form as one powerful and top rated module is already present in Drupal, that is Webform Module. Any beginner can work with this module because this is too easy. Continue reading
Get WordPress Table’s column name
For any reason if you need the MySQL table’s columns name in WordPress then use below code.
global $wpdb;
$table = $wpdb->prefix . 'table_name';
$column = $wpdb->get_col( "DESC " . $table, 0 );
Now you have the all columns of the table $column array. Print those
foreach( $column as $key => $value ) {
echo $value;
}
CREATE & DOWNLOAD ZIP FILE USING PHP
If you are trying to download multiple files in same time and downloading the files one by one then there is a better option to create a zip file, add the downloading files in the zip and download the zip file. Using PHP this is very easy. PHP ZipArchive() class provide all functionality to create a zip file with multiple file. You need PHP 5.2.0 and higher for that class. Continue reading
Fix: Force downloaded Zip file corrupted/invalid
If you are working on creating zip file and force download the created Zip file, then some time you will face an issue that the downloaded Zip file is corrupted, in Safari the auto decompression will also fail.
To solve above problem after set the header and before downloading the file use “ob_clean” and “flush” to clear the buffer.