Spokane Drupal Group February 16

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
jhodgdon's picture
Start: 
2017-02-16 10:00 - 12:00 America/Los_Angeles
Organizers: 
Event type: 
User group meeting

We hope you can join us for the next meeting of the Spokane Drupal User Group!

When
Thursday, February 16, 2017, 10 AM to noon
We meet on the 2nd or 3rd Thursday of most months at this time/location. Log in and join the Spokane Drupal User Group (see sidebar on https://groups.drupal.org/spokane-wa ) to be notified of future meetings, events, and discussions (typically just a few email messages per month).
Where
Spokane County Library - Argonne branch, 4322 N. Argonne Road, Millwood. We are currently meeting in the small conference room at the library. From the hallway, go into the library proper, past the checkout/information desk, take a right and you'll see the room on the right.
To be reminded, sign up!
To receive an email reminder closer to the date of the meeting, log in and click the "Sign up" button; log in and click "Cancel signup" at a later time if your schedule changes and you can no longer come. There's no obligation to come if you sign up (but we hope you will!). There's also no obligation to sign up in order to come (it's up to you if you want a reminder or not). However, the meeting could be canceled if the organizer isn't sure anyone is coming.
What
We spend two hours in a question and answer format, with the participants around a table and a laptop on a projector. Come with questions about a project you're working on, something you've learned that you'd like to share with others, a desire to improve Drupal in some way (documentation, programming, design, marketing etc.), or a desire to help others with their projects and questions. Or just come and listen and observe.
Who
Everyone is welcome -- the only prerequisite is having some interest in Drupal. This group is usually 5-10 friendly people, with experience levels ranging from novice to expert, so you'll fit right in. Because of the size of the group, you will have time to share something you've learned, or get your questions answered, or both!

Comments

Meeting notes

jhodgdon's picture

What we talked about today:

  • I (jhodgdon) will not be available to host/organize the Drupal Group meeting in April or May. Shawn and Jon have offered to host, if we have the meetings on the 3rd Thursday those months. So, I will set up the meeting notices, and they will come. YOU NEED TO SIGN UP or those meetings could get canceled! (Normally, lately, I don't worry too much about sign-ups.)
  • Pacific Northwest Drupal Summit: Feb 25-26, Vancouver BC -- next week!!!
    http://pnwdrupalsummit.org/2017

    Shawn has an extra ticket and a hotel reservation that could be used by someone... maybe he will post a message here?

  • DrupalCon is in Baltimore in April: https://events.drupal.org/baltimore2017
    And in Vienna in September: https://events.drupal.org/vienna2017
  • If you're traveling abroad, connect with the Drupal community! For example, if you're going to Brussels, you could post a message on
    https://groups.drupal.org/belgian-drupal-community
    and probably meet them!
  • Jon wants to be able to have a separate, special page layout for a few pages on the site. We figured out how to do this fairly easily, using the Context module (which is already on his site), and a few additions to his theme:
    • Make sure you have the Context module https://www.drupal.org/project/context
    • Set up a context to detect the "special pages". For our demo, we detected a particular content type; for Jon, he can detect his domain and some content type there, or whatever. (This is in the Conditions section when you are editing a Context.)
    • In the Reactions section of the context, add a "Template suggestions" reaction. Enter something like: page__jon_special_page. You can put whatever you want in here, but it has to start with page__. For more information on theme suggestions in Drupal, see https://www.drupal.org/docs/7/theming/template-theme-hook-suggestions
    • In your custom theme, copy either the page.tpl.php file that you already have there, or the one from the base theme, to your templates directory. Rename it page--jon-special-page.tpl.php (the underscore characters in the theme suggestion become hyphens in the file name, and then it needs a .tpl.php extension on the name).
    • Edit this template file to do what you want it to do.
    • Clear the cache, so that this new template is found.

    So far, so good! But we actually want different regions on this page, not the standard Sidebar first, Sidebar second, and Content regions. So, we can edit the custom_theme.info file, and add lines like this:

    regions[special_page_left] = Special Page Left
    ...

    (If you're using the Omega theme, you'll also need to create a Zone for your Region(s), and add that to the zones section of your info file, and then also go to the Settings for your Omega sub-theme, and make sure your region/zone gets displayed.)

    Then we need to edit the new template file to display these regions in place of the standard ones (or display the zones, if you're using Omega). For instance, the Sidebar First region is normally printed out with code like this:

        <?php if ($page['sidebar_first']): ?>
          <div id="sidebar-first" class="column sidebar"><div class="section">
            <?php print render($page['sidebar_first']); ?>
          </div></div> <!-- /.section, /#sidebar-first -->
        <?php endif; ?>

    The Content region is a "bit" more complex, about 30 lines of code. Anyway, what you need to do is get rid of the regions that you don't want to print in these special pages, and substitute the ones you do. So for the Special Page Left region, you would put in lines like:
        <?php if ($page['special_page_left']): ?>
          <div id="special-page-left" class="SOME CSS CLASSES HERE"><div class="section">
            <?php print render($page['special_page_left']); ?>
          </div></div> <!-- /.section, /#special-page-left -->
        <?php endif; ?>

    Finally, you'll need to clear the cache again (to recognize the new regions), then edit your context to add a Blocks reaction, and put blocks in these new regions (which should show up as regions in the Blocks dialog in Context).

    You can also add some CSS to your custom theme to style the new regions.

    Fun! It works, too!

    You could probably also use the Themekey module:
    https://www.drupal.org/project/themekey

    Or Panels
    https://www.drupal.org/project/panels

    But Context is pretty flexible, and pretty straightforward, and Panels has a lot of overhead.

    You could also use the Delta module (https://www.drupal.org/project/delta) to add some more theme-based reactions to Context, but it's a bit complicated.

  • I talked about how I solved a problem with a partially-multilingual site. See https://groups.drupal.org/node/516201 if interested.

    I will probably post it as a module on drupal.org sometime soon, and/or write it up as a blog post on poplarware.com. If so, I'll add a note to that other post, so if you log in I think you can "follow" that post to get notified when there is an update. Or if you use Twitter, I'm @poplarware (most likely I'll Tweet if I make a post or a module).

Partially multilingual site

jhodgdon's picture

I wrote up a blog post on that last item from the meeting notes:
http://poplarware.com/article/partially-multilingual-seo