Cataform

screenshot: 

I made this site for an old friend who is a metal fabricator and artist.

He was very particular and specific about the layout of the page being different for portrait oriented images vs. landscape oriented images. I am a themer more than a programmer and always try to use drupal's built in functionality before having something custom built.

At first I thought it couldn't be done, but in the end i had found several options. I ended up building it solely using views and the templating system and no custom code. This was difficult, and probably not ideal, but was a fun exercise in really pushing the limits of what you can do with drupal without any custom code.

The primary portion of the site is the gallery of projects. Each project has a handful of photos a title, brief description, and several taxonomies.

It would be natural to make projects a content type, and have all of the photos be filefields as part of the project. Without some serious php customization, i wouldn't be able to modify the layout depending on the orientation of the photo in in the primary position.

I finally decided to make the project a content type, and make two content types for images, one for portrait (tall), and one for landscape (wide) images. Now it gets more complicated. You never actually view a project page. Each page is a photo page that node references its respective project. (node_reference is a sub-module of CCK.) The header information and the taxonomy terms come from the project content and aren't duplicated in the photo pages.

As amazing as Views 2 is (and this project really showed me how much depth was built into it!) I did have to use a tiny bit of php code. I needed the node ID of the referenced project to use as an argument, but all i could get from the URL/URI was the node ID of the photo page. I was using the path module to automatically make the path of each photo show a path related to the project. You can't use arguments from the path aliased path, which is very frustrating. But I found this page Drupal URL / URI alias variables into a Drupal Block which gave me a nice little code snippet i was able to stick into Views without having to modify it that looked up the project node ID from the path alias table.

I was happy and proud that i was actually able to build it without having to hire a php programmer. I talked to people at the Denver DBUG meeting about the method i was using, and it inspired several other ideas. A guy named Eric pointed me to a post he had made about doing something similar programatically. This seems to be a better way to do it, since the images are added to the project, rather than the project being referenced from the images. I didn't feel like restarting the project, and it was probably beyond my skills, and beyond my friends budget to hire a programmer.

I may go into more details on this later.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options