Here's a little puzzle: display a table of nodes, each row containing the same content in all available translations.
How would you do it? Stumped, I asked that question on Stack Overflow a few years ago, but never received a satisfactory reply.
Then, a couple of days ago, someone asked me if I had solved it. I hadn't thought of that puzzle since then, but I would have felt bad answering no. So, with 3 years of i18n work under my belt, I decided to give it another go.
Lately, I've been devoting much of my free time to developing better methods of Drupal theming to achieve streamlined processes, simplicity and minimalistic code. I'm getting away from the default code bloat or "Divitis" that Drupal can sometimes present. In this article, I'll write about some of the methods and tools I've been using. This won't be a step by step tutorial per se but just a little smattering of tidbits and snippets.Test Case
The test case for all this is a new site I've been working on to showcase my photography. Photography is a serious passion for me and in the past year, I've had my work licensed by Land of Nod, a subsidiary of Crate and Barrel as well as some other companies. I decided I really wanted a clean and elegant site to show off my work that was responsive and modern looking with a "Flat UI" look and feel.Inspiration
In the process of designing and developing the new site, I realized early on that the that some of the Drupal modules available would not fit my needs exactly or there simply were none written. It dawned on me that I could really use any jQuery plugin I wanted as long as my markup was bare bones basic; ah therein lies the rub. I would then be able to use drupal_add_js and drupal_add_css to pull in the plugins I wanted.Try, Try again...
My main focus has been on creating elegant photo grids primarily using Drupal Views that resize effortlessly for different devices. I first tried the Views Isotope module (based on jQuery Isotope by Metafizzy) but disliked that it was really tricky to control as isotope was doing a lot of heavy lifting with jQuery to resize things and it just didn't seem to be elegant enough. I also tried Views Responsive Grid but that turned out to be inelegant as well. I discovered it was really important to be able to use media queries and pure CSS for grid resizing and only add in JQuery for filtering. I've gone a little against the grain here as I'm not doing pure masonry but I wanted a grid that had some white space and looked evenly spaced and moreover filled the entire width of my layout, in my case I'm using Nathan Smith's recent foray into the responsive grid game, Unsemantic.It's all in the settings
Views 3 for Drupal 7 has a nifty "Style Settings" UI interface. The first thing I do for any field is to check all three boxes, "Customize field HTML", " Customize label HTML", and "Customize field and label wrapper HTML". I can then set all those elements to "None." This essentially eliminates tons of divs and spans from your views output. Then in my custom Views template, I can do something like:<li class="mix <?php print $fields['term_node_tid']->content ?>">
<a href="<?php print $fields['path']->content ?>" class="mix-image-link" style="opacity: 1;" >
<img src="<?php print $fields['field_blog_hero_image']->content ?>" alt="<?php print $fields['title']->content ?>">
… and it outputs:<a href="/blog/163-freeway-park-san-diego" class="mix-image-link" style="opacity: 1;" >
<img src="/sites/default/files/styles/gallery_thumb/public/img_1352-edit_7.jpg?itok=abUIeZ5X" alt="The 163, Freeway in the Park, San Diego">
As you can see, the rendered markup is pretty simple. In addition, I'm also using Semantic Views and Image URL Formatter. The latter is a key module as it allows you to get an exact image path to a specific Image Style within Views and it's one of my new favorites in my site building / theming toolbox. So when I use:
<img src="<?php print $fields['field_blog_hero_image']->content ?> etc...
… that's already been set in Views to output only the text path to a specific image style. One could theoretically point to an adaptive image style as well for responsive designs. This mark up is far better than the typically dozens of divs that a default view will output.Get 'Griddy' With it
For the image girds themselves, I've gone back to basics by simply using text-align: justify. Barrel, a NYC design firm, published a nice blog post about this method. In my case I set text-align: justify for the Views Rows' parent container and then go back to an old standard which also uses display: inline-block for the Views rows themselves.
This actually works out much better for responsive grids rather than floating elements. Using Barrel's method, I found it fit nicely into my custom Views template and they were extremely helpful with some questions I had about incorporating this with dynamic data templates such as those typically used in Drupal.
For the filtering, I'm using one of Barrel's new plugins called MixItUp. It's similar to jQuery Isotope but for me it's much more minimalistic and really only focuses on the filtering and not layout.Semantics...
As far as my work goes from this project incorporating Unsemantic, I've essentially written a custom Drupal theme based on it and am incorporating some of what I've done as a 2.x branch for my Bamboo Theme on drupal.org. This is in part as I had lots of people who loved the 1.x branch but felt it was limited to not being a wider width for desktop and widescreen layouts.
What's cool about Unsemantic is that it's all percentage based within so all you need to do is set a max-width and boom, you're set to go with your custom responsive grid layout. Once again, I can't stress the importance of paying attention to and listening to your users, they are very important and I wrote about that recently. In this case, they got me thinking about how I wanted to approach my new photo site project.Tags:
- Drupal Planet
We are so excited that DrupalCon Portland was such an amazing success with more than 3,300 attendees, phenomenal speakers, and so many great community events where everyone bonded and had fun. And, as DrupalCon Portland comes to an end, we are very pleased to announce that our next North American DrupalCon will be held in Austin,Texas on June 2-6, 2014 at the Austin Convention Center.
If your site is left for a while, say throughout the night, and you find that hitting it for the first time in the morning (i.e. a cold start, an initial run) takes longer to load than after clearing your caches, then it's fair to assume that it's not merely a problem of caches expiring and refilling.
To nail this down to a Drupal problem, and not DNS, your Web server or your database, see if it can be reproduced on other systems to eliminate other variables. For example, I'm currently working on a project with Staging and Production each running on a dedicated Gentoo machine, other developers are using Macs for local development and I'm using Ubuntu. We haven't at all coordinated on configuration management, but we're all experiencing the same problem.
In this scenario, there are several things to check:
- Disable the automatic running of Cron. Over at Administration » Configuration » System » Cron, it's set to run every three (3) hours by default. It works by checking the last run on every page hit, and if it hasn't run in that amount of time, it does so. So when your site hasn't been accessed in a few hours, and then a user hits it, he/she is loading the page requested and waiting for a complete Cron run. It's the old Poormanscron that has become a "feature" in Drupal 7. Turn this off by setting it to "Never", and have one of your systems run it in the background every hour. See Configuring cron jobs using the cron command for details.
- Turn off the Update Manager module on Production. You don't want your production server wasting time consulting drupal.org for module updates when Cron runs. Enable it in your development environment so you'll be kept informed of security patches and upgrades. (Ideally, this task would be baked into your DevOps process of periodically syncing your Production database to your Staging/Development sites: turn on Devel, turn off Update Manager, etc..)
Once the above items are handled, there are some things you can do to bring the cache time down as well:
- Increase the Minimum cache lifetime. In Administer » Configuration » Development » Performance, set the Minimum cache lifetime higher if your site doesn't have a lot of writes. If you have a fairly static site, and you have that set to 10 minutes with Cron running every hour, your cache will get destroyed every hour. For situations like this, don't set it lower than "6 hours". You can set it to "1 day" if there are very few content changes.
- Consider warming/priming your cache. Once the cache lifetime expires, the page cache will be cleared. To fill it again, without doing so manually, follow the recipe over at Load Page Cache after cron Runs. Be aware that this is best applied if your Minimum cache lifetime is less than or equal to the time between Cron runs. Otherwise, you'll be hitting your site quite a bit for not too much gain.
After a ridiculously dumb move of overloading the Drupal Planet feed and the ensuing fix (thanks to Dave, David and Greg for the help during that), figured it was probably better to do a summary of recent Drupal video tutorials rather than posting each and everyone to Drupal Planet. So, here's the first go of it:
1. Started a new video tutorial series on cool Drupal 7 modules. The goal here is to keep them between 2 and 5 minutes and just introduce modules that are awesome. So far there are 7 videos in the series and I've been focusing on SEO modules recently: http://torontowebsitedeveloper.com/category/video/cool-modules
2. Released a video on how to create custom Drupal front pages based on user roles using the Front Page module. This is great if you have a private site but need to entice people to register: http://torontowebsitedeveloper.com/drupal-video-tutorials/how-create-cus...
3. I've now released 2 complete video tutorial series on creating e-commerce sites using Ubercart. You can find all 20 videos at http://torontowebsitedeveloper.com/category/video/ubercart or if you'd like, you can purchase the series on my site as well.
4. Finally, just started a mini series on how to create an activity feed on your Drupal 7 site. The first video in the series is available at http://torontowebsitedeveloper.com/drupal-video-tutorials/how-create-act...
Hope these help,
Round 2 of the Drupal Grand Prix will take place at Daytona Milton Keynes on Saturday 6th July. It's a great outdoor karting circuit that can host up to 35 drivers on the track at a time, and it's open to any UK Drupal companies and freelancers. (It's open to anyone outside the UK too, if you're up for the trip!)Blogs: Drupal PlanetTags: DrupalTiger FishTigerfish
Hi everyone, hope some of you had/having a great time at DrupalCon Portland. Since I could go I decided to do something useful and apply to Dropbucket Drupal Snippets Repository some new ideas I had in my mind. Long story short, last night I rolled out an update which brought the follwing:Read on about Cool New Changes at Dropbucket.org
Today I want to talk a bit about another cool module I found called Multi-path Autocomplete. With the use of an autocomplete widget, this module lets you easily add existing paths when you create a new menu item.
Drupal development can feel a bit like “black magic” when you’re getting started. Here’s a high level guide aimed at beginners to help point them in the right direction.Website Building & Drupal
Modules Unraveled: 063 DrupalCon Austin Announcement with Dianna Montalion Dupuis - Modules Unraveled Podcast
- Where is the DrupalCon going to be
- Why Austin?
- When is it? (June 2-6)
- With extended sprints before and after
- What does the tech community look like there?
- What does the Drupal community look like?
- DrupalCamp Austin (June 21st 2013)
- What’s the Drupal adoption look like in Austin?
- It’s strongly linked with adoption of other front and back end technologies. (node.js etc)
- Who’s going to be the “boots on the ground” in Austin playing “host”?
- Probably the same people that did it for Portland. Sponsors etc.
- Four Kitchens, Astonish, Whole Foods, City of Austin, Volacci, etc.
Day three was kicked off by Michael Lopp, ex Apple and Dictator at Palantir. His keynote "THE ENGINEER, THE DESIGNER, AND THE DICTATOR" was centered around the productive battle between art, science and execution. A refreshing contrast program to the horizontal hierarchy frenzy.
What else? Sessions, BOFs and another day in wonderful Portland, so different to most US cities I know: Small cars, cyclists, coffee snobs, microbreweries, and raaaaain! Lots.
It's Day 3 of DrupalCon, and so much has happened in the last 72 hours! From keynotes and two full days of recorded sessions, gallons of Stumptown, and let's be honest, sore feet from all the walking... well take a deep breath, because it's not over yet!
So, here's what happened yesterday...We built a website to help the tornado victims in Oklahoma
On Tuesday night, a team of volunteer Drupal developers gathered in the DrupalCon Portland coder lounge to build a website to help FEMA help the victims of the Oklahoma tornado.
Drupal is a lot like enterprise software. Before you think this is a bad judgement on Drupal or a slur please hear me out. It's more a description of Drupal based on my experience with it for nearly 8 years and my last couple years dealing with enterprise software. I want to dive into some specific points that may be good, bad, and even make us unhappy with some of the things that make us happy.
If you are a site builder or themer in Drupal, you might have a similar situation happen to you. You obtain a set of requirements for a content type, create all the necessary fields with semantic labels, and start building the displays and views. Great! Life is good. Now your project manager waltzes over to your desk to deliver an updated set of wireframes, and before you even get halfway down the page, you feel a breeze as you notice a person-shaped cloud of dust where your project manager just stood.... Read more
Symphony Blog: ST Fiddle, an organization Drupal theme, free-of-charge for anyone to use it for charity purposes
This organization theme was inspired by my talk with Kim McCluskey, the founder of SunInMyHeart.com, a charity fund. During his trip to Halong Bay, I have heard about what he did for SunInMyHeart to help orphanage children. So after the trip, I created this theme for organization and non profit purposes.
If you are interested in using this theme for your charity funds, please feel free to ask me and I will send you the package free-of-charge.
We have received many requests to download this theme. As we believe the use of this theme for your websites will bring alot of benefits to other people, especially for charity purposes, we have converted this theme to Drupal 7 and provide it free of charge. No more asking, just go to the theme page and click on the Download tab, you will be able to get it.Demo
See the demo here: Drupal theme ST Fiddle demo
First off, yes, I realize it's "sound bite", but given the context, "byte" sounds more applicable.
The Toads have been at Drupalcon Portland this week in force! With a sponsor booth to manage and two different parties to organize, we've been busy, but I've managed to squeeze a few sessions in as well. Here are some top quotes and takeaways along the way:
I belive every sitebuilder already had the need to wrap multiple fields with some markup, for example to group them in a fieldset or simply to wrap them with a div to solve theming issues. The easiest way to acoplish that is to use the field group module, wich gives you a nice and handy ui integrated in the core field_ui. It comes with a common set of often used wrappers, like expandable fieldsets or even horizontal and vertical tabs.
The module itself is a great tool for sitebuilders and themers because it is easy to use and exportable with the features module.
Sadly the module is pretty old and it is very complicated to get new features in it, because so many sites already use the module. So everyone lived with the overload of classes field_group appends to its containers and the poor set of available markup. Yannickoo from Loom created a patch, wich allows the user to decide how the wrapper should look like, by simply adding the tag in the ui.
This looks somewhat like in the image above!
If you want to take advantage of this new feature, you need to download the latest development snapshot 7.x-1.x, instead of the stable release.
Credits are going to yannickoo for this great work!Weitere Bilder:
WYSIWYG in Drupal 8 is going to rock, simple as that. Practically all annoyances, complications and other stuff we have had to endure In Drupal 7 and earlier has been fixed. Read all about it and also watch Nate Haug's DrupalCon Portland 2013 session about the improvements here.
Unfortunately Nate also revealed that Drupal 8 will still automatically delete files when their usage gets zero. That is a bad thing and I'll explain why I strongly believe that.Read the full "Drupal 8 WYSIWYG and File Cleanup" post on www.tsvenson.com
Often times it is needed to create module specific custom tables to store persistent data. Drupal offers a set of hooks in connection to this. Most commonly used among these are hook_schema() and hook_update_N(). First hook, hook_schema() holds the structure of table in the form of PHP array.Google Plus One Linkedin Share Button Tweet Widget Facebook Like