Technical Blog

Zyxware default image3
| 4 min read
There are many situations where you need to print a view within a node in your Drupal website. A good example would be a portfolio page showcasing the Drupal websites you have done using a view slideshow that showcases screenshots of your work. It is not directly possible to print a view within node just like there is no direct method to print a block within a node. However as Drupal is a very flexible CMS and there are methods to print just about anything and that includes printing a view within a node.
Fix Certbot Auto-Renew Error in Ubuntu
| 8 min read
Git is one of the most versatile opensource version control systems out there. If you have not already started using Git for your Drupal Development projects, this article should help you get started with it. Please note: I have been using Linux as my development environment, and almost all my illustrations would be for Linux. Still, the commands for using git should be the same for git implementations on all OSes. Please add in a comment if you have any doubts.
Fix Certbot Auto-Renew Error in Ubuntu
| 5 min read
If you are creating a View using the Drupal Views module and if you want to filter nodes based on nids (Node > NID filter) then Views gives you options to filter it based on a single argument of the nid. Currently there is no direct way to have multiple nid filters in Views similar to "Is one of" for Taxonomy. However there is a workaround to achieve that. Read onto find out more.
Zyxware default image4
| 2 min read
Some Drupal users have reported that there was a conflict with an external Jquery script and the Views Ajax. This occured when the Drupal user wanted to use the external script for some specifc purpose. The conflict was causing the Views UI to break. If you are experiencing this issue in your Views read on to find out the solution.
Fix Certbot Auto-Renew Error in Ubuntu
| 3 min read
Some Drupal Views users have encountered a Page not found error when they tried to navigate to the new Views Page files display they had created. This occurred after the preview page worked correctly and showed the correct test file in the table. It is not very clear what causes this error in the first place but there are multiple actions you can take to fix it. Read on to find out more.
Zyxware default image2
| 2 min read
Drupal Gmap module is a very useful module for embedding the functionality of Google Maps in your website. Currently the only way to access this map is to go to the "yoursitee.com/map/node and find all the relevant info on a single map. There is no direct way to access i location nodes on a single map, inside a block or panel pane, or on pages other than yoursitee.com/map/node. However there is a workaround for this. Read on to find out more.
Zyxware default image2
| 2 min read
Drupal Views can be displayed as both blocks and pages. If you want the View to be embedded in a node in your Drupal site then the obvious choice would be to display it as a block. View blocks can be embedded in a node as any other block by calling a set of functions like block_load and drupal_render. However it is not directly possible to pass contextual filters as arguments to those functions if your View uses them. Read on to find out how to pass contextual filters to a View embedded in a node.
Zyxware default image2
| 5 min read
The trick explained briefly We are not actually going to theme the file upload field as it is presently nearly impossible to do that. Instead we are going to put an ordinary looking 'dummy' input text field over the file field. Next we proceed to make the 'original' file upload field invisible but accessible to the user via CSS. So when a user clicks on the dummy input text field they are actually clicking on the file upload field itself. To make it authentic we are going to copy the file path from the file upload field to the text input field via javascript.
Zyxware default image3
| 5 min read
Are you looking for an easy way to delete hundreds and thousands of nodes in your Drupal CMS? We all know how to delete it using the normal admin panel which forces us to select all and clicking the delete button again and again. If you are a lazy person then probably you don't like to waste your time to find some stupid script to delete all nodes. In fact there is no need to do that, since somebody had already done that. I am saying about the Devel Generate module. Yes, Devel Generate to delete nodes!
Fix Certbot Auto-Renew Error in Ubuntu
| 3 min read
While trying to fix an issue with Drupal Views, I wanted to use a single custom table to store the char count of the body field of different content types instead of creating separate CCK fields for each content type to store the same. The question that came to my mind was how to integrate my custom database table with Drupal Views? Drupal's Views module provides a hook for doing this - hook_views_data().
Zyxware default image2
| 4 min read
The default behavior of drupal_redirect_form in Drupal 6 is to redirect the user to $_GET['q'] when an explicit redirect location is not set in $form_state['redirect']. So any form submission from a Drupal page with additional querystrings like in a paginated form (for example admin content listing forms or admin comment listing forms) will result in the querystrings being lost. This can be frustrating when you administer content from such forms as you have to click the pager link and go back to the previous page after form submission. This can easily be fixed by adding a submit handler for the form in question and setting form_state redirect correctly.
Zyxware default image3
| 3 min read
The default comment moderation system in Drupal 6 is crude at best primarily because of the limitation of the admin comment listings. The information that is shown by default are 'Subject', 'Author', 'Posted in', 'Time' and 'Operations'. Now the main objective of comment moderation is to reject spam comments. None of these fields give any information about whether the comment is a spam comment or not and you will have to view each comment by going to the edit view of the comment and then approve or reject the comment. This is a very laborious and frustrating process. You have three options to solve this problem and get a better comment administration interface - one is to create a comment view, another is to alter the default comment administration form and the third is of course a custom solution for comment administration.
Zyxware default image2
| 4 min read
This is how you would normally render a view display passing filter inputs via code: $view = views_get_view('view-name'); $view->set_display('display-name'); $view->is_cacheable = FALSE; $filter_1 = $view->get_item('display-name', 'filter', 'filter_1_id'); $filter_2 = $view->get_item('display-name', 'filter', 'filter_2_id'); $filter_1['value'] = "value1"; $filter_2['value'] = "value2"; $view->set_item('display-name', 'filter', 'filter_1_id', $filter_1); $view->set_item('display-name', 'filter', 'filter_2_id', $filter_2); dpm($view->render());
Zyxware default image4
| 4 min read
One of the Drupal sites we maintain had recently started slowing down considerably in spite of the site mostly being static and in spite of boost set up on the server. On examination of the site we found that two things were happening on the site. One was that the site was being crawled indiscriminately by rogue crawlers. This we solved using the DDOS deflate script and setting DDOS deflate to run every 10 seconds. The second problem was that there were some bots which were continuously sending POST requests to /comment/cid/reply pages. For this we had to come up with a workaround.
Zyxware default image4
| 3 min read
In Drupal every path in the site goes via index.php and goes through some Drupal menu. However to make the Drupal application behave live a typical static website in terms of URL architecture sometimes clients request for adding slashes to the end of virtual direcotry paths. At the same time slashes would not look good at the end of virtual file paths. There is an easy way to do this using apache htaccess rules
Zyxware default image2
| 3 min read
Blocks are regions on a Drupal website that show small but significant pieces of content. Blocks are an important component from the perspective of a Drupal website. Blocks are usually assigned to regions in a page and they are supposed to be printed on a page. However there are many instances where you might want to print a block within a content. It is not directly possible to assign a block to a region within content (node in Drupal speak) as you can do with a page. But as with everything in Drupal there is a way to do that.
Zyxware default image2
| 4 min read
Sometimes we get requests to update Drupal sites and get it done in less than 5 hours. If we take the Drupal update through the full fail-safe set of steps for Drupal updates we will never be able to complete updates in less than 5 hours on a site we don't maintain. For such sites when the cost of the site going down may not be too high for the site owner it might not be too big an issue if the update is run on a hit or miss approach. We normally do not recommend such an approach but this should work on most small sites without any issues.