Drupal

How to list nodes in multiple taxonomies in Drupal using Subquery

I found a good question regarding PHP snippet for Drupal. Usually, we will list nodes in multiple taxonomies using OR operator. However, you might need to list using AND operator which nodes must be in all specified taxonomies instead. It is not easy to do so using plain SQL. The straightforward solution is to use subquery.

How to manually sort table in Drupal

Drupal provides powerful and flexible built-in table sort functionality. However, it will only work with database query through standard db_query() and pager_query(). In many cases, rows are fetched from external system, e.g., mailbox. We may add a few lines to get the same behavior.

How to display image field inline in Drupal

Drupal is one of the greatest CMS right now. It is possible to build a site in minutes and a few days for customization without changing single line of existing codes. That means upgrading is painless. CCK is very powerful for customizing existing content types such as blog to have inline image per node using image field. However, default behavior is to display the image separately. It is not nice so I have to customize myself.

How to insert an image into primary links in Drupal

Drupal normally provides powerful and secure menu system to all of us. We are able to manipulate primary links and secondary links seamlessly and easily with little effort. However, sometimes we would like to insert an image instead of text. I found a good snippet but it does not work for me. This snippet is just for menu item but actually, I am talking about primary links or secondary links. Starting in Drupal 5, primary links and secondary links are not formatted by the theme engine, instead, a list of arrays are passed to the theme directly. By default, all menus are passed to check_plain() to prevent unexpected security holes so we cannot insert HTML tag here include . Fortunately, this is Drupal. We can customize theme to let us insert just only img tag.

How to list the latest 11-20 nodes in Drupal (2)

According to the question and my snippets, the same one asked me again to extend the previous codes to show the author's name besides the node title. In addition, it would be nice to display node title and its author in a table form. Fortunately, this is Drupal. It is very easy.

How to list the latest 11-20 nodes in Drupal

I found an interesting question regarding Drupal at Codenone. One would like to list the latest 11-20 nodes in a block. He tried to use Views module with no luck. I think so. Listing the latest nodes in a block using Views is very easy but I don't see any clue to get the next 10 nodes. Anyway, it is possible to write a snippet code to fulfill this requirement.