Watch us live at 2pm as Greg Linch, Joey Baker and I discuss innovation in online student news.
Okay, replaced the live stream with a saved version of the session. Hope I didn’t embarrass myself too badly. Watch after the jump.
Journalist slash web geek
Watch us live at 2pm as Greg Linch, Joey Baker and I discuss innovation in online student news.
Okay, replaced the live stream with a saved version of the session. Hope I didn’t embarrass myself too badly. Watch after the jump.
My entry in the Tomorrow’s News, Tomorrow’s Journalists blog ring for January. The topic asks:
Do you think it will be the “old” news organizations that achieve the radical transformation they need, or is it more wise (as a journalist) to invest your time in a “new” news startup?
I want to think about this question from the perspective of an investor considering buying a newspaper and implementing a drastic turn-around plan. Or perhaps, with the same money that investor could go off and finance some people to start a competitor. What should they do?
Big news! At long last, the DP has launched it’s first public web site on Drupal at http://34st.com for our weekly arts and entertainment magazine, 34th Street. We’ve been working on developing an alternative to College Publisher since I started my term as Web Editor-in-Chief at The Daily Pennsylvanian in January. After months of waffling and pressure we decided to move ahead with development and committed to launching a new website. And finally, we’re here.
Last time, I wrote about the data structure underlying our website running on Drupal and promised that I would write again about theming.
The Drupal theming layer is quite powerful, but can also quickly become incredibly complex. It also depends on module developers to play nicely and make all their code easily themable. It also requires a designer to learn how to work with Drupal and all it’s eccentricities.
Drupal themes depend on layers of overrides and hooks. Drupal core provides a default layout, which can then be modified by modules, then the template engine, then the theme and finally an optional subtheme. At each layer the previous output can be modified or overridden. That way, if someone were designing a set of themes or wanted to present options for a user to customize the site’s look and feel it could degrade gracefully.
Since we weren’t worrying about any of those things, we did nearly everything in the top-most sub-theme layer.
![]()
Luckily for us the Zen starter theme makes much of this easier.
To develop our theme, we were lucky enough to have a great starting point in the amazing Zen starter template and it’s great documentation. We made a Zen subtheme as a folder within Zen with their Starter Kit.
Note: One big mistake I made when we started working on our subtheme was naming it “34st”. As it turns out, many of the theme override functions require you to name them THEMENAME_functionname. Unfortunately, PHP variables can’t start with numbers so after some frustration and griping I had to rename the subtheme.
Many places advise themers to use the Content Templates module to theme different content types. With Zen however, I found it much easier to just create files in the sub-template directory with certain naming conventions. For our article content type, a file named node-article.tpl.php themes it. For an issue, node-issue.tpl.php contains the theme. Since these files are theming a node, it’s possible to see all the variables in the array by simply doing a <?php print_r($node); ?> in a human-readable format. Content Templates, however can do the same thing, and with a much nicer interface.
For the most part, after finding all the appropriate variables, we simply plopped them into the appropriate places in the template. But, within these template files, we still have complete access to PHP and the entire Drupal API. Which of course means that I get lazy.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <?php //Covering all the different numbers of bylines if (($node->field_byline[0]['view'] != '') && ($node->field_byline[1]['view'] == '')): ?> <div class="article-byline"> <div class="author-teaser-name-nodelink">By <?php print $node->field_byline[0]['view'] ?></div> </div> <?php elseif (($node->field_byline[0]['view'] != '') && ($node->field_byline[1]['view'] != '') && ($node->field_byline[2]['view'] == '')): ?> <div class="article-byline"> <div class="author-teaser-name-nodelink">By <?php print $node->field_byline[0]['view'] . ' and ' . $node->field_byline[1]['view']; ?></div> </div> <?php elseif (($node->field_byline[0]['view'] != '') && ($node->field_byline[1]['view'] != '') && ($node->field_byline[2]['view'] != '')): ?> <div class="article-byline"> <div class="author-teaser-name-nodelink">By <?php $numauthors = count($node->field_byline); print $node->field_byline[0]['view']; for ($i=0;$i<$numauthors-1;$i++) { print ', ' . $node->field_byline[$i]['view']; } print ' and ' . $node->field_byline[$numauthors-1]['view']; ?> </div> </div> <?php endif; ?> |
That’s my code for handling all the different possibilities for multiple authors on a single article. For more elegant code, this should be higher up in the templating than the .tpl.php file, but it’s much easier this way.
For each field in a content type, you can choose two ways of displaying it. The Teaser is used when the node is being viewed on the front page, or in a section listing, and Full is the whole article is being read. Pretty self-explanatory. But it does mean that in each .tpl.php file you have to theme both. Here’s a sample.
1 2 3 4 5 6 7 8 9 10 11 12 13 | <?php if (($teaser) && (!$page)): /* * This case governs how articles show up in section page views, in the nodereferrer on authors, * and everywhere else an article teaser (not on the front) is shown. * */ elseif (($page) && (!$teaser)): /* * This case is for displaying the whole article on its own page. * */ endif; ?> |
We also get other fun template variables like $is_front so we can do things like so.
1 2 3 4 5 6 7 | elseif ((($teaser) && (!$page) && ($is_front)) || (($page) && ($teaser))): /* * This first case is for articles that are on the front page or in the sidebar. * articles in the current issue. The second half of the OR only happens when node_view is * manually called like node_view($node_object,$page=TRUE,$teaser=TRUE); * */ |
For reference, here’s the three different views of a single article.
We received our archives from College Publisher as a set of CSV files. My next post will address how we imported those archives.
What did you think of this post? Got more questions about our Drupal install? Leave a comment. The new website is 34th Street Magazine, poke around and leave us some feedback!
Joshua Benton of the Nieman Journalism Lab at Harvard just coined a new term, ““Holovaty’s Law”, that I really like. Well, I believe he coined it because Google turns up no results for “Holovaty’s Law”.
The post linked as Holovaty’s Law, by the way, is a classic. If you haven’t read it and you’re interested in news and journalism at all, you need to.
Let me take the concept and run a little further with it. And thanks to Benton, the law already has it’s first corollary!
Thoughts? Refinements? Other corollaries?
It seems like there’s a dearth of math geeks interested in journalism. Searches for “law of online news”, “fundamental theorem of online news”, “fundamental theorem of online journalism”, and “law of online journalism” all turn up nothing.
I wrote before about the new 34th Street Magazine website being in Alpha.
This is the first post of a series on what we did to Drupal to make it behave the way we want it to, how we implemented different features and to ask for feedback and advice on how to do future features.
To start out understanding Drupal, it’s important to understand that Drupal was designed and the developer’s focus is largely on creating flexible websites for communities, NOT for publishing or blogging. For instance, there isn’t a natural distinction between readers and administrators among the user roles. (Adding content is at node/add/* not admin/*) A lot of the work involved in setting up a site on Drupal is to work around the default values and settings and make it behave the way you want to.
Part of the joy of using Wordpress is that it’s defined for a very specific purpose and all the development work that goes into it is designed to make it easier to blog. With Wordpress, it takes very little work to go from a default install to writing your first post.
That’s not true for Drupal. No one would use Drupal with only its core functionality and the default settings. But with a little work, it becomes much, much more powerful and better suited for publishing a news website than Wordpress.
The problem I’m still struggling with now is how to import data into Drupal’s database. The database structure is quite complex compared to our current site, or a Wordpress site, but luckily the Content Construction Kit abstracts all of that when the site is being built. And that’s the topic of today’s post.
Everything in our system is a node. Stories. Slideshows. Sections. Authors. Issues.
The CCK module lets us define all the different information each node needs and tie authors to articles and articles to sections and issues with node reference fields. Each content type is themed separately with a different template and the different ways that piece of content can be viewed are defined by a set of boolean PHP variables.
Our site uses the following CCK content types.
When creating fields and content types, this is all you see. Pick data types and title them. For the most part, the rest of the process is completely opaque. To learn more about the database structure of CCK, there’s documentation in greater detail here.
There are several tables that store data for CCK fields.
A lot of the heavy lifting in Drupal is done at the theming layer. Luckily Zen makes it all much easier. That’s what I’ll be writing about next time. Some of the other upcoming posts will address how we handle images (Imagecache and CCK), how we theme our newsletters and how we handle multimedia.
What did you think of this post? Got more questions about our Drupal install? Leave a comment. The new website is at http://beta.34st.com, poke around and leave us some feedback!
In the course of developing Drupal for the DP, we’ve been fortunate that we’ve had to write very little (themeing layer excepted) from scratch. Chalk it up to to the strength and robustness of the Drupal community that nearly every function we wanted, there was a module for.
One module that I did have to write from scratch was to replicate a function from College Publisher. After copy and pasting a story into CP’s interface, there was a button run all that doubled the line breaks, among other things.
Drupal wraps text separated by two line breaks with <p> tags and uses the <br /> tag to in-between text separated by one line break. By default, text copied out of InCopy only has one line break between paragraphs.
When Sean Blanda posted about the Temple News moving to Wordpress, this was one of the 6 problems he laid out as having. Keep reading…
Exciting news on the CMS front.
As some may know, The Daily Pennsylvanian web staff and I have been working on using Drupal to run our website and as a replacement for College Publisher on and off since the spring. The first part of that process is now nearly done and we have a nearly complete website for our magazine 34th Street!
We made the decision to go ahead and develop and launch a site in Drupal a few weeks ago and since then have been in a somewhat hectic mode scrambling to get all the launch features ready. A great deal of thanks goes to the folks who made the New York Observer site happen and wrote up how they did it.
Now it’s on to testing and training the other editors on how to use the system and looking for places to make the site work better, and make publishing easier. We also have to write a complete set of documentation for future and current editors on how to use the system, how to modify it, how to deal with Drupal upgrades and what to do in case things go wrong. Keep reading…
Every post you see before this one (one exception) is imported from my old blog at http://albertgate.blogspot.com. This shiny new site is hosted by WebFaction and I’ve been very happy with them so far even if at $9.50 a month it’s a tad expensive for hosting a personal site. Their servers will let me play around with things like SVN and Django. Keep reading…
Posts from my previous blog at albertgate.blogspot.com are freshly imported! Unfortunately though, no comments from about the middle of 2006 until now were imported.
This blog still needs lots of work before I start linking it around though.
Recent Comments