Web Programming

Eight web developer warning signs

Most of us have been there. You talk to someone who has had a bad experience with a site built on a popular web framework and then once you look at the code you suddenly understand why. So I decided it could be useful to create a little cheat sheet. If you find yourself thinking I've done that as you read along, it might be time to get back to bagging groceries, building beautiful houses, practicing law or whatever else you're good at so you don't harm more folks out there who are just trying to make a living.

So here's the list:

Making outbound links generic

I'm looking for a good way to make outbound links from a Drupal site not show the full path of the referring page when the user reaches an external server. There are some posts in the Drupal forum about doing this sort of thing. In short, instead of wanting to track clicks I'm more interested in not making the internal URL evident to the external server. For example if I have an internal page at the following URL:

http://example.com/top-job-applicants

One easy way is of course not to use path aliases and that would be the quick work-around. However, in some cases I want users to be able to remember a URL and most don't recall 'node/1234' as well as they do 'job-applicants'. The challenge is that for privacy reasons I don't want to make evident to the operators of a server linked from the internal page that the user is an applicant (and maybe they aren't but are a prospect I want to encourage to apply).

A cursory look at the modules list didn't reveal the answer. Likely a module for this with a filter that can be applied to redirect all links through it will be the solution.

Sure I know Dreamweaver, Front Page and more

As a hiring manager I'm always skeptical when I get a resume filled with "technical" classes from one of the myriad of technical schools around the country. When I've worked with graduates of these programs it seems they have a marginal, but usually satisfactory, understanding of how technology is supposed to work. The problem is I rarely need people who can work with technology that is working. If technology is working and things are simple there is little that end-users need. Even relatively simple tasks like deploying computers depends upon a specific understanding of the complex situation that is most business networks. Few organizations do a "out of the box" installation of a Microsoft Active Directory and run 100% machines that work in that environment. These complexities mean a technical manager is quickly looking for skills that don't come from these technical schools. Ironically because they do tend to come in people who are self-motivated to learn the technology any way they can often the requisite skills are stronger in those who haven't been through this sort of program.

Sharing Space

First a minor clarification. While this serise has been titled a redesign, we're really talking here about first doing a re-implementation in order to enable a re-design.

.htaccess

Once a site is in produciton it's best to do away with .htaccess for performance. This is simple enough as the directives in .htaccess can be put in the Apache configuration file. For these early stages, though, it is great to have a .htaccess file so you can make changes without having to restart. Drupal ships with a .htaccess file that works for re-writing URLs so one can do "clean" URLs.

The problem with the site at hand, however, is it needs to still access the old site while the new Drupal site is going up around it. Drupal's .htaccess file contains the following directives that we are concerned with:

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

This tells the webserver that if a client requests a file and there is no file by that name and no directory by that name to send /index.php instead and to take the requested "page" and send it as an argument. Thus /node/3 becomes index.php?q=node/3. This works fine if the user requests a regular file. However it breaks down if they request a directory. If a user requests /oldsite/ Apache doesn't know that the "if the file doesn't exist" part applies to /oldsite/index.html until it is too late. Apache merrily serves up index.php.

To solve this problem (and a couple of variations) we add the following three lines before the three above in the .htaccess file:

Category: 

Let's Get Together

The best is the enemy of the good. - Voltaire

One of the challenges facing the migration of a website from a collection of loosely gathered HTML and PDF files into a content management system is finding the balance between keeping the current site running and implementing the new site. In dreamland where information systems staffs and communications staffs are sitting about waiting for things to do there are plenty of helpers. In the real world it's not that simple.

This website started as a collection of pages in a single directory. Something like this:

/www/dept1.html
/www/dept1_hours.html
/www/dept1_additional_info.html
/www/dept1_special.html
/www/dept2.html
/www/hello.html
/www/home.html
/www/otherdepartment.html
/www/staff/staff_bio1.html
/www/staff/staff_bio2.html

As organizations are dynamic additional people come along and have some additional needs. In addition some departments have staff allocated who can do some HTML work and want to improve their sites. With time the directory grows to look more like:

/www/dept1/dept1.html
/www/dept1/dept1_hours.html
/www/dept1/dept1_additional_info.html
/www/dept1/dept1_special.html
/www/dept2.html
/www/hello.html
/www/home.html
/www/otherdepartment.html
/www/staff/staff_bio1.html
/www/staff/staff1/mypage.html
/www/staff/staff_bio2.html

Basically there are tons of files at the first level and a handful of second, third and fourth level directories. A little good fortune made this project easier. The existing site included a "include" directory. This is fortunate because Drupal has an include directory but it is called "includes".

Category: 

Pages

Subscribe to Web Programming