Pedro Posada | Blog
  • 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 - 3:12pm
    Simple sample of a long mysql query I did for a module.
  • 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 14, 2008 - 11:26am

    I think this is an interesting link.

    http://badvista.fsf.org/

    Read and comment at the BadVista.org blog

  • Posted on March 6, 2008 - 10:07pm

    This is a quick and dirty php script that generates a web picture gallery.

    There is no need for a database because it recursively scans the directory tree and outputs all the images inside a n html table. It generates a navigation menu to switch between galleries as well.

    It's a good solution if you deal with big amounts of pictures because you can just use FTP to upload the pictures and the script generates the thumbnails and galleries automatically.

  • 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.