Dynamic Display Block?

Events happening in the community are now at Drupal community events on www.drupal.org.
ithacaindy's picture

Anyone here with experience creating a carousel using the Dynamic Display Block module for OP? I'm aiming for a story picker like those used by TNR or TheNation.

(By the way, I can't wait for the production version of OP 2.3 - love the backend additions.)

Comments

I'm using Dynamic Display

pkcho's picture

I'm using Dynamic Display Block to highlight the articles for our Business Journal site (www.scvbj.com).

DDblock is a little daunting to set up because you need to configure the preprocess function, but the developer has done a pretty extensive job at documenting the set up process. I have found answers to pretty much every question I've had on his site (http://ddblock.myalbums.biz/). He is also fairly good about replying to email, though my case may be different because I purchased one of his themed slideshows.

If you have a specific question, I will try my best to help if I can.

-Joe

Joe, I plan to purchase one

ithacaindy's picture

Joe,

I plan to purchase one of his slideshow themes, also. The main question is how to position the slideshow atop the left and middle columns; I'm a words guy, not a css coder.

ithacaindy, I totally

pkcho's picture

ithacaindy, I totally understand where you are coming from. I came in working on this project more from the content management side, but ended up doing a lot of this myself because there wasn't a budget for side projects. OP provided a substantial base from which to build this site.

You are going to need to tweak the html in the page-front.tpl.php in your theme folder.

You will find divs such as

<div id="sidebar-left">, <div id="homepage-center"> and <div id="homepage-right">

You will see these regions defined in the openpublish_theme.info file in your theme folder. This is what you will see in the .info file:

regions[primary_menu] = Primary Menu
regions[left] = Left Sidebar
regions[right] = Right Sidebar
regions[over_content] = On Top of Content
regions[under_content] = Underneath the Content
regions[header] = Header
regions[footer] = Footer

You will see these regions printed in your html (page-front.tpl.php), for example:

<div id="sidebar-left">
  <?php print $left; ?>
</div>
<div id="homepage-center">
  <?php print $over_content; ?>
</div>

The "sidebar-left" div is where the content in the "left" region will end up displaying. Same thing goes for the "homepage-center" div which designates where the "over_content" will go.

If you need to add regions, you will then need to define a new region in the openpublish_theme.info file. For example...

regions[top_left_region] = Top Left Region

and then add the code to the page-front.tpl.php.
<div id="top-left-region">
<?php print $top_left_region; ?>

Once you have tweaked the html in your page-front-tpl.php, you will then need to add the necessary css to the css files. You can then control where and how you want that region to display. Firebug for Firefox and Coda (on the Mac) are great tools to help you examine and make changes to your css.

Once the region is properly defined and styled, you will be able to use it as you would any other region.

I hope this gives you an idea of what to do with this. I'm sure someone could explain this clearer or better but hopefully this is a start.

If you don't want to touch the code at all, you probably need to work with someone to help you with that.

Dynamic Display Block and PreProcessors

ithacaindy's picture

I was running through the Dynamic Display basic tutorial and had no trouble, an image appears in the footer for the test. However, when I moved onto the advanced tutorial, problems arose - no image or slider text appears. What is my best move - buy a commercial DDB theme? Can anyone give me pointers how to customize the Advanced DDB tutorial to OP? Thanks, much.

Ed

Thanks. This gives me much to

ithacaindy's picture

Thanks. This gives me much to digest. (As you can guess, I've jumped back into OP with both feet.)

Of interest to OP as concerns

kenyan's picture

Of interest to OP as concerns DDBlock, have a look at:
http://drupal.org/node/938158
and eventually
http://groups.drupal.org/node/101354

If you buy a theme it should be easier as you should get direct support but if like me you use the free themes, the going can be tough but worth the knowledge gained (especially as concerns the preprocess functions).
My issue was I wanted to use panels and not a a new region to display the ddblock.

@ithacaindy - preprocess

kenyan's picture

These are the changes i made to the advanced tutorial preprocess functions. I'll just list the whole file. I put these are the end of template.php in the openpublish theme. This is because putting them in my sub-themes template file did not seem to work (don't know why).
Please note the arrows showing changes:

/*!
* Dynamic display block preprocess functions
* Copyright (c) 2008 - 2009 P. Blaauw All rights reserved.
* Version 1.6 (01-OCT-2009)
* Licenced under GPL license
* http://www.gnu.org/licenses/gpl.html
*/

/
* Override or insert variables into the ddblock_cycle_block_content templates.
*   Used to convert variables from view_fields to slider_items template variables
*
* @param $vars
*   An array of variables to pass to the theme template.
*
*/
function openpublish_theme_preprocess_ddblock_cycle_block_content(&$vars) {
  if ($vars['output_type'] == 'view_fields') {
    $content = array();
    // Add slider_items for the template
    // If you use the devel module uncomment the following line to see the theme variables
    // dsm($vars['settings']['view_name']);
    // dsm($vars['content'][0]);
    // If you don't use the devel module uncomment the following line to see the theme variables
    // drupal_set_message('<pre>' . var_export($vars['settings']['view_name'], true) . '</pre>');
    // drupal_set_message('<pre>' . var_export($vars['content'][0], true) . '</pre>');
    if ($vars['settings']['view_name'] == 'articles') <------here {   
      if (!empty($vars['content'])) {
        foreach ($vars['content'] as $key1 => $result) {
          // add slide_image variable
          if (isset($result->node_data_field_main_image_field_main_image_fid)) <------here{     
            // get image id
            $fid = $result->node_data_field_main_image_field_main_image_fid;  <------here
            // get path to image
            $filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
            //  use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
            if (module_exists('imagecache') && is_array(imagecache_presets()) && $vars['imgcache_slide'] <> '<none>'){
              $slider_items[$key1]['slide_image'] =
              theme('imagecache',
                    $vars['imgcache_slide'],
                    $filepath,
                    check_plain($result->node_title));
            }
            else {
              $slider_items[$key1]['slide_image'] =
                '<img src="' . base_path() . $filepath .
                '" alt="' . check_plain($result->node_title) .
                '"/>';
            }
          }
          // add slide_text variable
          if (isset($result->node_data_field_teaser_field_teaser_value)) <------here {      
            $slider_items[$key1]['slide_text'] =  check_markup($result->node_data_field_teaser_field_teaser_value);  <------here
          }
          // add slide_title variable
          if (isset($result->node_title)) <------here {                                                                  
            $slider_items[$key1]['slide_title'] =  check_plain($result->node_title);  <------here
          }
          // add slide_read_more variable and slide_node variable
          if (isset($result->nid)) {
            $slider_items[$key1]['slide_read_more'] =  l('Read more...', 'node/' . $result->nid);
            $slider_items[$key1]['slide_node'] =  base_path() . 'node/' . $result->nid;
          }
        }
      }
    }
    $vars['slider_items'] = $slider_items;
  }
}

/
* Override or insert variables into the ddblock_cycle_pager_content templates.
*   Used to convert variables from view_fields  to pager_items template variables
*  Only used for custom pager items
*
* @param $vars
*   An array of variables to pass to the theme template.
*
*/
function openpublish_theme_preprocess_ddblock_cycle_pager_content(&$vars) {
  if (($vars['output_type'] == 'view_fields') && ($vars['pager_settings']['pager'] == 'custom-pager')){
    $content = array();
    // Add pager_items for the template
    // If you use the devel module uncomment the following lines to see the theme variables
    // dsm($vars['pager_settings']['view_name']);
    // dsm($vars['content'][0]);
    // If you don't use the devel module uncomment the following lines to see the theme variables
     // drupal_set_message('<pre>' . var_export($vars['pager_settings'], true) . '</pre>');
    //  drupal_set_message('<pre>' . var_export($vars['content'][0], true) . '</pre>');
    if ($vars['pager_settings']['view_name'] == 'articles') <------here {                                             
      if (!empty($vars['content'])) {
        foreach ($vars['content'] as $key1 => $result) {

      // add tooltip variable     <------here                                                                                         
      $pager_items[$key1]['tooltip'] =  $result->node_title;    <------here                                      

// add pager_item_image variable
          if (isset($result->node_data_field_main_image_field_main_image_fid)) <------here {        
            $fid = $result->node_data_field_main_image_field_main_image_fid;  <------here
            $filepath = db_result(db_query("SELECT filepath FROM {files} WHERE fid = %d", $fid));
            //  use imagecache (imagecache, preset_name, file_path, alt, title, array of attributes)
            if (module_exists('imagecache') &&
                is_array(imagecache_presets()) &&
                $vars['imgcache_pager_item'] <> '<none>'){
              $pager_items[$key1]['image'] =
                theme('imagecache',
                      $vars['pager_settings']['imgcache_pager_item'],
                      $filepath,
                      check_plain($result->node_title));
            }
            else {
              $pager_items[$key1]['image'] =
                '<img src="' . base_path() . $filepath .
                '" alt="' . check_plain($result->node_title) .
                '"/>';
            }
          }
          // add pager_item _text variable
          if (isset($result->node_title)) <------here {                                                                       
            $pager_items[$key1]['text'] =  check_plain($result->node_title);  <------here
          }
        }
      }
    }
    $vars['pager_items'] = $pager_items;
  }
}

OpenPublish

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: