Some drupal pain about "q=user"

In drupal, when you go to http://www.yoursite.com/?q=user you get redirected right away to http://www.yoursite.com/?q=user/777 (if 777 is your user id and if you are logged in). If you are not logged in, you see the login page.

My client wanted users to be redirected to http://www.yoursite.com/?q=user/me instead. How simple, right? WRONG!

Sometimes, (or often in Drupal) the simpliest thing end up being a nightmare.

I wrote a drupal module to handle this:

function foo_menu($may_cache) {
  if ($may_cache) {
    $items[] = array(
      'path' => 'user',

Drupal Indexing - node.tpl.php is for layout only

If you are working on drupal, I am sure you were asked at one point to display additionnal data on a node page. Or maybe to filter the data. For example, only show tags from some vocabularies, but not all of them. The very first reaction might be to modify node.tpl.php to call some function that will return the new data and echo the data.

Let's assume (for simplicity) that the defualt node.tpl.php looks like this by default:

<div class="node">
  <h2><?php echo $title ?></h2>
  <?php echo $author ?> wrote on <?php $node->created ?><br />
  <?php echo $content ?><br />

Why is Drupal still using CVS?

Angie wrote a nice article that explains why Drupal looks like it is still living in dark ages..

http://drupal.org/node/289117

SVN Introduction

Under used resources - Get all the answers

In any development shop with more than one developer, there is always at least one developer that is THE reference for the project/platform/framework/cms that most developers go to with questions.

Let's face it, developers are lazy. I mean very lazy. I am lazy! So we look for the easy way. The path with the least resistance. Sometimes (maybe most of the times) that is going to see that senior developer and asking him questions.

explode() is not strpos() - [empty() is not broken]

Let's say that I worked on a recipe website.
The goal was to generate some HTML whenever we had one or more ingredients to show.
The data comes from a legacy MS-SQL server which returns a comma seperated list of ingredients.
When no ingredients are found, do not display the ingredient block and title.

I coded something like this:

  $ingredients = explode(',', $mssql_row['INGREDIENTS']);
  if (!empty($ingredients)) {
    $output .= theme('item_list', $ingredients, t('List of ingredients'));
  }

PS: I was using Drupal, that is where theme() and t() comes from.

Limitation in the Drupal Menu system

The Drupal menu system API says that each path in the menu should be unique. I think it should read "must be unique".

On his blog, ragaskar talks about his own problems he had with menu items pointing to the same path.

The following are other reference to it:
* http://drupal.org/node/186117
* http://drupal.org/node/203079

Proposed Drupal Module : views_active_filters

This is a new module that I would like to contribute on drupal.org. Feel free to comment and download the source for review.

Before I install Drupal

Whenever I start a new drupal project, my first task is to setup a version control repository. I have used CVS for 8 years but now that I had a taste of SVN, that is all I am using. Once I setup the repositary I create the folder for the project:

svn mkdir file:///var/svn/myproject -m "Creating initial folder for my project"

Then I download the latest version of the drupal series I want to install. Since a number of critial modules are not yet ported to Drupal 6 (views, cck, panels to name a few) I stick to Drupal 5 for now.

 

Karl's comparaison on Symfony vs. Zend

Karl Katzke talks in his blog about the difference between symfony and zend framework and why he prefers one over the other.


Symfony has a lot of ‘buzz’ and user support, and there are excellent guides from both the authors and the communities to get users started on the learning curve. Zend doesn’t have as much, and the documentation is really directed at more experienced developers who are old hands with the more complex aspects of object-orientation.

Syndicate content