Advanced DDBlock not displaying in custom theme, possible filepath issue?

amyl - August 8, 2009 - 00:30
Project:Dynamic display block
Version:6.x-1.0-rc6
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:postponed (maintainer needs more info)
Description

Hi there,

I am hoping you can help me with a display problem with the Advanced DDBlock, using a modified version of the LiteJazz theme. I have gone through the ddblock installation steps several times, and also solved many issues with the very helpful FAQ/documentation, but -- I still cannot get ddblock to display any content. :( I just get a header for the block -- no pager, no photos, no text, etc.

A few notes about the set-up:

- the site's ddblock works fine on a completely different theme, mygarland (but unfortunately, this is not the theme that I am using...)
- the required modules are installed
- the permissions are in place
- template.php has the preprocess code added, with correct theme name, combojazz
- this is a multisites set-up
- the site uses pathauto
- the modules/themes are in: sites/all
- the images are in: sites/sitename1/files
- the file system setting is: sites/sitename1/files
- the news_items view is set-up (by import)
- there are two test news nodes (from the imported type)
- the site used to have Litejazz as the main theme, with a custom subtheme. Since then, I've gone ahead and combined them into a single custom theme. (Subthemes can sometimes affect preprocess functions in modules, from what I've read, so I tried eliminating that.) Tests were tried in both set-ups, but -- the ddblock still did not appear.

The debug result in the combojazz theme is:

'news_items'

stdClass::__set_state(array(
'nid' => '46',
'node_title' => 'DDBlock2 test',
'node_data_field_pager_item_text_field_pager_item_text_value' => 'testpage1',
'node_type' => 'ddblock_news_item',
'node_vid' => '46',
'node_data_field_pager_item_text_field_slide_text_value' => 'This is some test text for the slide 2',
'node_data_field_pager_item_text_field_image_fid' => '33',
'node_data_field_pager_item_text_field_image_list' => '1',
'node_data_field_pager_item_text_field_image_data' => 'a:3:{s:11:"description";s:0:"";s:3:"alt";s:0:"";s:5:"title";s:0:"";}',
'node_revisions_body' => 'More test of content area',
'node_revisions_format' => '1',
'node_created' => '1249586735',
))

The preporcess function is:

/*!
* Dynamic display block preprocess functions
* Copyright (c) 2008 - 2009 P. Blaauw All rights reserved.
* Version 1.3 (18-MAR-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 combojazz_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'] == 'news_items') {
      if (!empty($vars['content'])) {
        foreach ($vars['content'] as $key1 => $result) {
          // add slide_image variable
          if (isset($result->node_data_field_pager_item_text_field_image_fid)) { 
            // get image id
            $fid = $result->node_data_field_pager_item_text_field_image_fid;
            // 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,
                    $result->node_title);
            }
            else {         
              $slider_items[$key1]['slide_image'] =
                '<img src="' . base_path() . $filepath .
                '" alt="' . $result->node_title .
                '"/>';    
            }         
          }
          // add slide_text variable
          if (isset($result->node_data_field_pager_item_text_field_slide_text_value)) {
            $slider_items[$key1]['slide_text'] =  $result->node_data_field_pager_item_text_field_slide_text_value;
          }
          // add slide_title variable
          if (isset($result->node_title)) {
            $slider_items[$key1]['slide_title'] =  $result->node_title;
          }
          // 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'] =  '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 combojazz_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'] == 'news_items') {
      if (!empty($vars['content'])) {
        foreach ($vars['content'] as $key1 => $result) {
          // add pager_item_image variable
          if (isset($result->node_data_field_pager_item_text_field_image_fid)) {
            $fid = $result->node_data_field_pager_item_text_field_image_fid;
            $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,
                      $result->node_data_field_pager_item_text_field_pager_item_text_value);
            }
            else {         
              $pager_items[$key1]['image'] =
                '<img src="' . base_path() . $filepath .
                '" alt="' . $result->node_data_field_pager_item_text_field_pager_item_text_value .
                '"/>';    
            }         
          }
          // add pager_item _text variable
          if (isset($result->node_data_field_pager_item_text_field_pager_item_text_value)) {
            $pager_items[$key1]['text'] =  $result->node_data_field_pager_item_text_field_pager_item_text_value;
          }
        }
      }
      $vars['pager_items'] = $pager_items;
    }
  }   
}

Thanks in advance for any help you can provide. Very much appreciated! :)

Best,

- Amy

#1

drecute - September 2, 2009 - 11:59

I have this problem as well. Block title is the only displayed object. No images, no slider text, no custom theme.

I use my own theme.

Pls help. Thanks

#2

ppblaauw - September 3, 2009 - 01:12
Status:active» postponed (maintainer needs more info)

@drecute.

Please give some more detailed information, so I can help you better.
Attach your template.php file.
Attach the result of the drupal_set_message lines when you uncomment them in the preprocess functions.
If possible provide a link to the Internet site.

#3

drecute - September 3, 2009 - 13:40

Thanks for the reply.

After much perseverance, I got it working on my dev installation of drupal (Which contains less installation of modules).

But I have not gotten much success on my other robust drupal website which has the following configuation,

1. A multisite website consisting of 3 websites, managed by the domain module
2. About 97 enabled blocks
3. Mysql 5 and php 5
4. A single database for all the sites
5. The following are the list of enabled modules
domain access
ajax
apache solr
cck
visitor path
category
ctools
color picker
devel
coder
faceted search
fusion chart
image
imagecache
smtp authentication
menu attribute
404 blocks
beauty tips
composite layout
custom page
custom search box
email confirm
excerpt
fckeditor
content slider
field indexer
faq
html mail
ie
image fupload
imce
job queue
jump
lightbox2
menu breadcrumb
menu icons
menu trai
multiblock
nice menu
node field indexer
node block
paginattion
path redirect
pathauto
persistent login
quick menu
quicktabs
Redirect 403 to User Login
safari search
search config
secure pages
similar entries
taxonomy breadcrumb
teaser by content type
text resize
thickbox
user visits
webform
weight
panels
print
email verify
swftools
core search
taxonomy menu
jquery update
views
slider

In addition, the domain module has an extra module called domain blocks, which helps to place blocks in different domains. The point is that whenever I place the ddblock slideshow on a specific domain and click the submit button, the process reverts itself. What I mean is that the block refused to be placed in a specific domain. I have to always go into the database to place the ddblock block in the domain that I prefer. I know you might be thinking that this has nothing to do with the ddblock, but I want to say it has. This is because I know the domain blocks works well and I use it all the time.

As it stands, on this drupal installation, the attached file is what I could see.

Also, i noticed that if I uncomment the drupal_set_message function, I dont see the debug lines of code on my theme. I have already printed the $message variable on my theme.

I have also attached attached a copy of my template.php file.

About the internet site, I'm sorry I have not uploaded it to the server. Still testing on my local machine.

Thanks.

AttachmentSize
output_of_adv_ddblock_on_a_multisite.jpg 15.07 KB
template.php.txt 5.25 KB

#4

drecute - September 3, 2009 - 14:01

In addition, I also get the following error;

warning: Invalid argument supplied for foreach() in C:\wamp\www\skyebankng-site\sites\all\themes\skyebank-nigeria\custom\modules\ddblock\ddblock-cycle-block-content-upright20.tpl.php on line 47.

I saw this from the video as well, but if I can just see the message from the drupal_set_message method, I would have been able to debug this, following the video instruction.

#5

ppblaauw - September 4, 2009 - 00:25

@drecute

Thanks for the extra information

In the error message I see that your theme is called: skyebank-nigeria

In the preprocess functions you use skyebank_nigeria with an underscore.
You need to change this to: skyebank-nigeria.

Hope this helps you further for now, please let me know.

I will see what I can do for the other issue with placing the blocks.

#6

drecute - September 4, 2009 - 09:09

But no it doesn't.

I believe drupal makes use of the name you specify in the theme info file and not the name of the theme folder.

Also, drupal doesn't take an hyphen for the name of a theme.

Thanks for the reply anyway.

I am still debugging myself to know what the problem is. I'm suspecting it has something to do with conflict in one of the installed modules. But I can't place my finger on which one is it exactly. The reason for this is that, I got this running fine on a drupal installation with limited amount of modules.

#7

ppblaauw - September 8, 2009 - 02:11

Can you place the two drupal_set_message lines:

    drupal_set_message('<pre>' . var_export($vars['settings']['view_name'], true) . '</pre>');
    drupal_set_message('<pre>' . var_export($vars['content'][0], true) . '</pre>');

before the first if statement in the content preprocess function to see if the preprocess function is called.

If it is called can you send the result?

#8

drecute - September 8, 2009 - 09:22

From the template.php file I sent to you, I've already done that. And my result is that nothing got displayed unto the screen.

According to the video, this function is meant to be uncommented in order to debug the code. This I have done.

Please I need more of your help on this. This is my second week without solution.

Thanks

#9

ppblaauw - September 8, 2009 - 09:44

So, it means that the preprocess function is not called.
I don't know anything else to solve this without having a look at the installation.

#10

drecute - September 8, 2009 - 14:15

I dont know what installation you are asking for. Maybe you should be a little bit more specific.

Moreover, this is how is looks from this live website http://ww3.skyebankng.com/content/skye-visa-card

Thanks

#11

ppblaauw - September 9, 2009 - 01:46

At the site I see there are no slider items in the slideshow.

Can you attach your whole template.php file with the adjustments I mentioned earlier.

Could you rename your theme to skybank_nigeria

With a look at your installation I mean: Access to your Drupal Internet site and file system, to pinpoint what the issues are.

#12

drecute - September 9, 2009 - 09:26

Can we talk via a private network, so we could get the problem solved.

I will create a separate account so you have the access to the site.

But first can we talk via another medium. Like GTalk(dreyemi@gmail.com).

Do you mean the theme folder? In the info file it is skyebank_nigeria, which to me is what actually matters.

#13

GiorgosK - September 30, 2009 - 09:01

Sounds related so I will put it in this thread

I am using domain access http://drupal.org/project/domain
and domain blocks http://drupal.org/project/domain_blocks
to assign visibility per domain

but on ONE of the ddblocks visibility is not assigned using the
block configuration pages (I will investigate as to why)

but when assigning visibility by hand (tweaking Table: domain_blocks with phpmyadmin)
then I can see the ddblock

#14

epingel - October 14, 2009 - 04:08

I am having the same issue, except I don't see my block in domain_blocks to enable. Have you found a solution?

 
 

Drupal is a registered trademark of Dries Buytaert.