Pedro Posada | drupal recipe
  • Posted on April 22, 2008 - 12:02pm
    .htaccess code snippet to have any url to redirect to another url. You would insert this in your .htaccess file. This is very useful when you are migrating a static html site into a Drupal site.
  • Posted on April 17, 2008 - 12:14am
    Snippet to generate a CSV (comma separated values) file from any table or combination of tables from the data base.
  • Posted on April 16, 2008 - 11:40am
    I have come across this issue many times now. It started to appear in Drupal 5.x . The reason is not completely clear to me but some say that it has something to do with the tac_lite module. It seems that when you enable this module and then you disable it, it won't properly restore the node_access table in the database. It won't create the default node_access row. To fix it, just run the following query:
  • Posted on April 10, 2008 - 10:32am
    This snippet contains the default regions in the bluemarine theme. I just copy and paste it in the template.php and start adding new ones to the array. And then I define them inside my page.tpl.php This is very useful if you want to place blocks in custom places and easily manage them from the blocks page.
  • Posted on April 9, 2008 - 4:51pm
    This code is very useful to avoid duplicated posts in your Drupal site. Some times when users try to submit a form, the form will take more than usual to reload or to respond. In those cases you want to have the submit button to disappear and to show a message saying that the form is being processed. I found this piece of code somewhere in the durpal.org site. I have been using it all the time and works like a charm. This is a jQuery snippet and goes inside a block or page or node.
  • Posted on April 3, 2008 - 12:45pm
    I was trying to build a custom user interface that would allow the user to create an e-mailer. I wanted to create a web-form with a number of options. The purpose of this was to make things as easy as possible to the user to add content and submit the e-mailer to the recipients.
  • Posted on March 31, 2008 - 5:51pm
    This is a recipe that I used to load the content of my "Portfolio of Websites" page. I took advantage of jQuery and Drupal menu system to generate an asynchronous http request, serve the content and show it inside a div tag. This is the module code:
  • Posted on March 17, 2008 - 12:10pm
    This is a Drupal very simple way of redirecting users after login, based on their user role. 1. Add a new block. 2. Insert the following code into the block body:
  • Posted on March 3, 2008 - 4:59pm
    I created a custom module that turns CCK forms into email feedback forms easily. The purpose of this module is to easily create forms with the flexibility that the CCK module gives you and have the content of the forms be emailed to any address you want as well as create nodes and then have the ability to use VIEWS to sort the content and create reports and more. Basically you create a content type using CCK module and then, in the content type settings form you will get the following options: - turn this content type into feedback form.
  • Posted on March 1, 2008 - 3:31am
    The following code was used to have several images or a flash animations rotate inside a block. I wanted to have many images stored in the database and have them appear inside a side block without refreshing the page, so that visitors would be exposed to multiple ads without having to refresh the page and while they were reading the content of the page. As you can see in the code, I call the style and javascript files externally. I created a cck content type to store the images and/or flash animations. After you create the content type using cck module, you can manage your banners using the views module.