Eyes On Sales
About a year or so ago, I picked up my first soup-to-nuts Drupal site development job. Angela Byron, who I now work with a Lullabot, referred me to a guy building a web site for sales professionals. He was converting existing content from a homegrown CMS that had been running for a couple of years, and needed a Drupal guy to put things together.
Given the in-my-spare-time schedule and somewhat fuzzy scope, it dragged on for quite a while, but for a couple of month now it's been up and running successfully. While it's not as wild-and-crazy as MTV or The Onion, it led to a number of cool patches for the Views module (hello, custom arg handling!) as well as some enhancements to modules like Profile that may be rolled into future versions. In addition, it was the first time I put energy into using themed views for almost every listing page on the site.
I didn't design the theme -- a dedicated graphic designer put it together and I like it a lot. I just took the raw HTML template and adapted them into a Drupal theme with a support module to handle the tricky stuff. It turned out pretty well, all things considered, and I'm really happy with the results. If you're interested in checking it out, visit Eyes On Sales.




Interesting
Jeff when you say “While it's not as wild-and-crazy as MTV or The Onion” your rather modest as the layout is rather complex to a newbie
Just wondering did you query nodes and then format the nodes in relation to the page on which they were appearing or is this one of the patches you are referring to for the views mode ie group nodes per topic or per month at the bottom of the page
http://www.eyesonsales.com/topics/extending_relationships
and what’s your scheme for a process like this, I’ve been trying something similar but I’m finding I have to custom write a lot of functions that I will find rather difficult to re use in the future
would be interest to see how you tackled the process
tks
M
Background info
Thanks! It's important to note though that I didn't design the theme; when I received the templates they were already in HTML and CSS files. It took some translating of classes and IDs from the designer's original files, and then a lot of work to get Drupal's output to match the HTML that the CSS expected. The theme code is divided up into a number of tpl.php files for different node types, a template.php file with quite a few theme function overrides, and a separate views_theme.inc file that handles the theming of the views used on the site, since its a relatively isolated chunk of code.
The 'listing' format I think you're referring to -- with each node shown as a two-line blurb in a month-by-month list -- is used all over the site. I created a generic theming function that accepts a view, and whenever I had a page that used a view, I tossed it into that theming function to generate a consistent look and feel. I did indeed use 'full node' views so that I'd have access to the complete node data, but I didn't have to do any additional queries beyond that.
The "separate nodes by date" bit was done with just one theme 'helper' function:
function theme_date_header($date) {
static $formatted_date;
$new_date = format_date($date, 'custom', 'F Y');
if ($new_date != $formatted_date) {
$formatted_date = $new_date;
return $formatted_date;
}
return FALSE;
}
function my_theme_function($list_of_nodes) {
foreach ($list_of_nodes as $node) {
$header = theme('date_header', $node->created);
if ($header) {
$output .= $header;
}
$output .= theme('node', $node);
}
}
Obviously, the formatting in the above example is all but nonexistant -- on the EOS site the $header is wrapped in a couple custom classes, etc. But the idea is the same. The helper function takes a date, and formats it as a string of text containing the month and year. It keeps a static version of that formatted text around, and each time it's called it compares the new incoming date to the last one it received. If they differ (IE, the node being formatted is the first one from a new month), the two formatted dates differ and it changes the 'stored' copy and returns the formatted string. In 'my_theme_function', every time I call it I look to see if it returned some text (ie, a formatted date) or FALSE. If it returned text I print out the date header. It takes a little squinting at first but it works very, very well in practice.
pretty neat
Tks for taking the time out and going through that as its something that Im interested in, developing my skills further in theme overriding, I was mainly interested in how the nodes were displayed and not really the html theming side of it so mighty grateful for the explanation
keep up the good work.
Post new comment