Skip to main content

Scott Blackburn's Library tagged drupal_howto   View Popular

Building Drupal installation profiles | Damien's Site

  • There can be unexpected dependencies with your intended setup, like not being able to add menu items to taxonomy pages for terms that don't exist yet (i.e. add menus after taxonomy terms), to needing to assign role permissions after content types are created so you can set who should have access to them.
03 Nov 09

how to display block when any page in specific book is shown? | drupal.org

  • blocks don't load the node, hence the arg and nid approach. this will do what you want, but only works in Drupal 6.

    parent method will work, but only two levels deep. you'll have to add a bit more logic if you want it to work with children of children.

    <?php
    if (arg(0) == 'node' && is_numeric(arg(1))) {
     
    $nid = arg(1);
     
    $node = node_load(array('nid' => $nid));
    if (
    $node->book['bid']==41) {
    return
    TRUE;
    }
    else {
    return
    FALSE;
    }
    }

    ?>
27 Jun 09

The Great Pretender: Making your data act like a field | Lullabot

  • Now, though, it's possible for any module to tie into CCK's field management page to control the positioning of custom content. The key is hook_content_extra_fields(), and in this article we'll show you how to use it.
  • Now, though, it's possible for any module to tie into CCK's field management page to control the positioning of custom content. The key is hook_content_extra_fields(), and in this article we'll show you how to use it.
01 Apr 09

Views - hiding labels for empty fields | drupal.org

  • I just realized I had the same problem in my D6 site and I figured out a solution using the Theme Information in my theme.


    I copied the code for views-view-fields.tpl.php and added an if statement to check for the existence of $field->content, namely:


    <?php if ($field->content): ?>
        <?php if ($field->label): ?>
          <label class="views-label-<?php print $field->class; ?>">
            <?php print $field->label; ?>:
          </label>
        <?php endif; ?>
    <?php endif; ?>

    Seems to work fine. I'd like to hear of better/different options.

08 Mar 09

Free your content of PHP: Moving PHP code out of blocks, views and nodes | 2bits.com, Inc. - Drupal Development, Customization and Consulting

  • From the early days, Drupal had the ability to embed PHP code in its content. This provides flexibility and functionality, most importantly, nodes and blocks can contain dynamically fetched data from the database using custom queries and displayed them in other content.



    This is an easy approach to get such data without writing a module. All you need to do is assign the PHP input format filter to the node or block and paste your PHP code in it, and voila, you have dynamic content.


    Code in Content: the issues



    However, this approach is suboptimal and has serious drawbacks, including:

02 Feb 09

Views Help: How to get a field to "Link this field to its user" besides username | drupal.org

  • Though one would think the $field object is what we wanted-- the actual object we needed is $row (even though we're only looking at one field in the row).


    Put the following into the field tpl file to see what the necessary info is:

    <?php
    print '<pre>';
    print_r($row);
    print
    '</pre>';
    ?>

    Then, to actually make the link, put the following in your field tpl file:


    <?php
    $account
    = user_load($row->uid);
    print
    l($row->profile_values_profile_fullname_value, 'users/' . $account->name);
    ?>

    Change 'profile_values_profile_fullname_value' to the proper field alias (based on the $row output). Also, be sure to change 'users' to whatever the path is for your user accounts.


    I also had another thought-- given your use case, you may want to consider the http://drupal.org/project/realname module as well. It will replace usernames with whatever field(s) you designate all over the site.


    EDIT: I had another thought. I'm not sure of the performance implications of doing a user_load in the template file. Another option is to add the 'User: name' field to the view but exclude it from display. Then you could avoid the user_load and change the code in the tpl file to:


    <?php
    print l($row->profile_values_profile_fullname_value, 'users/' . $row->users_name);
    ?>
27 Jan 09

Imagecache Example: User Profile Pictures | Lullabot

  • D6


    <!--paging_filter-->

    Because i need this too, i have rewritten it.

    In addition you can use Lightbox2 or Thickbox for displaying the full user picture.


    You have to choose the presets under :

    /admin/settings/profile_imagecache

1 - 20 of 69 Next › Last »
Showing 20 items per page

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo