We have a site that is running the views slideshow module to display advertisement images. Recently a client asked us to prevent these advertisements from displaying only one item on the screen. In order to do this I began dissecting the views slideshow module code and I came across the template_preprocess_views_slideshow_cycle_main_frame() function. This function takes care of rendering the rows.
Today I needed to prevent a Drupal 6 website from getting indexed by the search engines. This would normally be a relatively easy task by having the robots.txt file disallow everything. The problem I ran into was that I was using Drupal's multisite feature and I needed to prevent a sub-domain from getting indexed while the main site continued getting indexed.
The other day I was tasked with redirecting the Drupal login form to the user account page. On any other form this would work by adding the #redirect tag to the form in a form alter function like this:
Today I needed to create an ajax powered form using Drupal 7, the caveat being that I needed one user action to perform multiple ajax actions to different sections of the form.
To begin, my form element with the ajax looks like this:
Today I was setting up a website that was using FlickrSync to pull images from Flickr. FlickrSync creates one node per image and uses Flickr's tags as taxonomy terms. Perfect.
I created a new Term view to pull all taxonomy terms associated to the 'Gallery' vocabulary I had created. The problem I ran into was that the view pulled ALL image nodes tagged with each gallery term. This was not what I was looking for. Instead, I wanted a list of each term and one image node, not all nodes.
I've recently been exposing a custom module's data to views 3 in Drupal 7. I copied the code from the uc_product module and for some reason, I couldn't get my views handlers to get registered with the system. Everything I tried would result in a broken/missing handler error. After scouring the online views documentation, http://views.doc.logrus.com, I finally found a line directing me to the advanced help module.
I'm building an e-commerce website and I decided to use Drupal 7 and Ubercart. During development I discovered that Ubercart 2's function, hook_cart_item, was no longer available to Drupal 7. This led me to the question:
Today I needed to take the parent menu item from my primary links and add it to the beginning of my secondary menu links. To begin, my menu structure looks like this:
- Primary 1
- Primary 2
- Secondary 2.1
- Secondary 2.2
- Secondary 2.3
- Primary 3
Default Menu Setup
The $main_menu variable will print a list item with:
- Primary 1
- Primary 2
- Primary 3
When you click on the 'Primary 2' link the $secondary_menu variable will display:
Today I needed to create a view the filtered items by a range of prices. The prices for these nodes were stored in a CCK number field. After searching for an easy 'plug and play' method of doing this I quickly began writing my own code to accomplish this task. To summarize, I accomplished this by using the following functions:
Today I was working on a mobile theme for a client of ours and I needed to remove the printer friendly link from every page. The first thing I did was create a hook_link_alter() function in my custom module and quickly realized this would alter every theme.