Disable Drupal module from database
Posted by khumlo Freddie in Drupal on 29. Nov, 2011 | 0 Comments
To disable Drupal 6 module from database, open PHPMyAdmin or mysql console and select your database, then run the query written below. UPDATE system SET STATUS = 0 WHERE name = ‘module_name’ LIMIT 1; Note: Under module_name, enter name of the module of which you want to disable. Bookmark on Delicious Digg this post Recommend [...]
Disallow anonymous users to run cron
Posted by khumlo Freddie in Drupal, PHP on 28. Nov, 2011 | 1 Comment
For one reason or the other, sometimes we may require to limit drupal’s cron access only to authenticated users or admin user. Let me present two ways of doing it. Choice is yours depending upon your requirement. First, hacking of cron.php file. Second, using .htaccess and allow only administrator to run cron using “run cron” [...]
How to set global variable in Drupal module
Posted by khumlo Freddie in Drupal, PHP on 11. Nov, 2011 | 0 Comments
To create a global variable which will be available throughout the module, you need to declare a global variable outside a function as usual but with one exception that you also need to have to assign a value to it. So, there is a slight change in implementing global variable in simple PHP application and [...]
Reset Drupal’s theme through using MySQL / Database
Posted by khumlo Freddie in Drupal on 10. Nov, 2011 | 0 Comments
Ever fall into a situation where you have modified or switch a theme or mistakenly deleted(before disabling) the current theme only to find out that the theme display goes kaput or nothing is shown on the page. These will leave you with no UI to work on. Well at this point of time you may [...]
How to create seperate template tpl file for each drupal content type
Posted by khumlo Freddie in Drupal on 09. Nov, 2011 | 0 Comments
There is a generic template page called page.tpl.php but what if we want to create unique template for each content type? Add the below code into the template.php file inside your theme folder. /** * Override or insert PHPTemplate variables into the templates. */ function phptemplate_preprocess_page(&$vars) { // Add per content type pages if (isset($vars[’node’])) [...]
Upload multiple files using HTML 5 and PHP
Posted by khumlo Freddie in HTML, PHP on 28. Sep, 2011 | 0 Comments
This application of uploading multiple files will work only on new versions of Firefox, Safari and Chrome. IE stills continues to be developer’s nightmare in this powerful feature too. Until the arrival of HTML 5, we had to upload only one file at a time but now we can upload multiple files at one go. [...]
How to display blocks only for a specific content type
Posted by khumlo Freddie in Drupal on 08. Sep, 2011 | 0 Comments
To create a block which will only be displayed in case when user visits a specific content type, I am using an example of displaying a block throughout all blogs. You have one simple option to add blog/* at the listed pages but what if user access a blog content type through using node/1234, it [...]
How to create multi-site using Drupal
Posted by khumlo Freddie in Drupal on 04. Aug, 2011 | 0 Comments
In this post, I am going to write of how to run several multiple Drupal sites using a single codebase. Sometimes you may want to host multiple sites with almost same code and for each addition of site or domain name, you only need to create new database where user table is shared throughout. If [...]
PHP AJAX send JSON data to server
Posted by khumlo Freddie in AJAX, PHP on 25. Jul, 2011 | 0 Comments
This is a simple example is how you can send a JSON data through AJAX with a small tips of how to convert a PHP array to JSON data, stringify JSON data in javascript and converting JSON data back to PHP array. Converting PHP array into JSON data (say edit.php file). $value = array(’id’==>1, ‘name’==>’khumlo’); [...]
Single submit button for multiple HTML forms using PHP
Posted by khumlo Freddie in AJAX, PHP on 22. Jul, 2011 | 0 Comments
I want to share my experience with all of you of how to submit multiple forms with single submit button using PHP. It’s a great day for me today, finally I have executed what I term it as a creepy grapevine task. Well The problem goes these way:- There are multiple forms under single form [...]




