Submitted by admin on Sun, 04/10/2011 - 02:24
Just in 40 minutes ago, i write article about using Memcached + Nginx + Php-fpm on Drupal 7. I wrote that articles in same time experimenting my development server ( yoodey.com ). I'm satisfhy with NGINX + Memcached and it change until i have thinking about combine it with Varnish. Yes, it sound crazy for me, but i think it is good way to deliver Drupal 7 in HIGH WAY!
Submitted by admin on Sun, 02/20/2011 - 11:37
When you inserting data into Drupal 7 database, you should use db_insert(). Maybe you facing a new problem while inserting data into your custom table.
You got "Syntax error or access violation" while inserting data. Is that right? Okay, look at this point :
1. You think already do right script but it's can't be saved.
2. You forgot to sanitize data, but istill doesn't works after sanitizing.
3. You have HTML, DIV and Text inside the data.
This is an example saving data by db_insert() and throw error because some coloumn issue :
Submitted by admin on Sat, 02/19/2011 - 17:01
Varnish is important tools to make our web pages load fast. In other hand, Drupal 7 give great perfomance by default. Combining both of the will give awful result. In this instalation, i'm using Ubuntu 10.10 Maverick in Amazon EC2. Here arep steps to install Varnish and configure Drupal 7 to work with it. If you want default Varnish Instalation you can go : Install Varnish on Ubuntu 10.10
1. Install Varnish on Ubuntu
sudo apt-get install varnish
Submitted by admin on Mon, 02/14/2011 - 11:56
In Page.tpl.php we can get $node and showing value inside it. When we need url_alias only based on node->nid in page.tpl.php, what we do? Querying into url_alias tables is not good and waste resource. We can use DRUPAL_LOOKUP_PATH() to get URL_ALIAS value from node id. Here are example :
Submitted by admin on Tue, 02/08/2011 - 11:01
After Installing APC, sometimes you get "Unable to allocate memory for pool. in module_load_include()" after login into Drupal 7 administrator. It's not caused by Drupal 7 but PHP does! This is because APC not configured properly. To solve this problem, you need configure APC in /etc/php5/apache2/php.ini and add this configuration :
Submitted by admin on Fri, 02/04/2011 - 12:05
Sometimes we need to add custom javascript in Drupal 7. Eventually, in Bartik themes, html header is taken by default html.tpl.php ( in system ). But, adding custom javascript is easy if we using template.php, hook_page_alter($page) and drupal_add_html_head(). Here are steps to do :
1. Open template.tpl.php
2. Creating hook_page_alter()
If you have custom themes, rename customtheme with your theme or default bartik theme name. In this example, i have custom theme named with "customfat".
Submitted by admin on Thu, 02/03/2011 - 10:55
Deleting nodes one by one in admin page of Drupal 7 is such a pain. If we have thousand nodes and want to delete content that contain key "insurance", we need to make some little script. Querying node id and delete it programmatically. Here are how to delete :
Submitted by admin on Wed, 02/02/2011 - 20:20
Change or adding header meta like meta description, meta keywords or meta robots in Drupal 7 is a little bit different compared with Drupal 6. We use drupal_add_html_head() for adding meta like meta desription or meta keywords in header. In our theme, we should call hook_page_alter() for embeding meta. Here are the script :
Submitted by admin on Thu, 01/27/2011 - 11:28
After exporting comment from Drupal 6 into Drupal 7, we see that comment statistic was messy. This will make in front or category page, the comments will not shown and it have impact with another pages too. So, here are script to fix broken comment in Drupal 7 :
Submitted by admin on Wed, 01/26/2011 - 14:34
Now we try to migrate all comments in Drupal 6 database into Drupal 7 programmatically or bash scripting. Before, in previous part, i have explained about migrating nodes, taxonomy, users and url_alias from Drupal 6 into Drupal 7. In this part, moving comments is just same method with another previous part. See my previous article about multiple connection in Drupal 7 for further explanation. We have 3 queries in this steps and probably consume a lot of memory depend on how many comments you have. Here are the script :
Pages
Recent comments