Hi there,

Like many folks, I'm having the white block problem when trying to implement ddblock on a site I'm currently developing (http://www.icucom.net:81.)

I'm using the Acquia Marian 3 beta theme that is built on the Fusion theming system, so I have created the template.php file (see attached) in the acquia_marian directory (rather than in the fusion_core directory,) and added the requisite ddblock themes to sites\all\themes\acquia_marina\custom\modules\ddblock. I've also modified template.php with the correct node type name and theme name.

I've followed the tutorial to create an advanced block, which I can see, but it has no content. If I switch the settings from using Cycleblock to Default, I see the list of three nodes I created along with their fields and images, which suggests that it's working at least to some degree.

The log shows an error as well:

Invalid argument supplied for foreach() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\sites\all\themes\acquia_marina\custom\modules\ddblock\ddblock-cycle-block-content-upright10.tpl.php on line 47.

And the logging function of ddblock gives this output:

    *
      'slider_items'
    *
      stdClass::__set_state(array(
         'nid' => '400',
         'node_title' => 'Slider 1',
         'node_data_field_pager_item_text_field_pager_item_text_value' => 'Slider 1',
         'node_type' => 'ddblock_news_item',
         'node_vid' => '406',
         'node_data_field_pager_item_text_field_slide_text_value' => 'Slider 1',
         'node_data_field_pager_item_text_field_image_fid' => '714',
         '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' => 'Slider 1',
         'node_revisions_format' => '2',
         'node_created' => '1275600510',
      ))

So maybe that's a problem with something in Views?

I'm also using the latest versions of all of the required modules (except jQuery Update, which breaks my site and isn't needed on D6.16 anyway, so I removed the dependency requirement.)

Anyway, I'm hoping that you can help, and that it's some simple oversight on my part.

Thank you!

-=Delty

CommentFileSizeAuthor
#6 template.php_.txt5.83 KBdelty
#2 template.php_.txt5.83 KBdelty

Comments

ppblaauw’s picture

Status: Active » Postponed (maintainer needs more info)

Can you attach your template.php file, so I can help you better.

delty’s picture

StatusFileSize
new5.83 KB

Oh, I thought I did - here it is again.

Thanks!

-=Delty

ppblaauw’s picture

Your view_name is slider_items instead of news_items.

You need to change:

    if ($vars['settings']['view_name'] == 'news_items') {

in

    if ($vars['settings']['view_name'] == 'slider_items') {

in the preprocess functions

Hope this helps you further, please let me know.

delty’s picture

Ah, that was just left over from re-copying the php to a new template.php file just to make sure I had everything. I changed it to the correct view name and cleared the cache, but still have the same issue.

Thanks for taking a look,

-=Delty

delty’s picture

OK, I ended up starting over from scratch by deleting the content type, view, and deleting the block, then re-creating everything using the imported templates - no monkeying around with the names or anything this time around.

What I get now is... nothing! It's as if the template.php isn't even being loaded. I must be a supremely bad direction follower or something, so I'm going to try some more - I'm a glutton for punishment!

-=Delty

delty’s picture

StatusFileSize
new5.83 KB

All right, I did a totally fresh install, following along with the instructions, and using the default importable view and node type. It still doesn't work. :(

If I set the display to default, I see the view with text and images, but with the cycleblock, nothing. I don't seem to be getting the "invalid argument" error in the log any more though.

Thoughts?

    *
      'news_items'
    *
      stdClass::__set_state(array(
         'nid' => '408',
         'node_title' => 'test 1',
         'node_data_field_pager_item_text_field_pager_item_text_value' => 'test 1',
         'node_type' => 'ddblock_news_item',
         'node_vid' => '414',
         'node_data_field_pager_item_text_field_slide_text_value' => '

      test 1

      ',
         'node_data_field_pager_item_text_field_image_fid' => '725',
         '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' => '

      test 1

      ',
         'node_revisions_format' => '2',
         'node_created' => '1275704222',
      ))

In IE8, I get this script error too.

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET CLR 1.1.4322; eMusic DLM/4; InfoPath.2; OfficeLiveConnector.1.5; OfficeLivePatch.1.3)
Timestamp: Sat, 5 Jun 2010 11:59:49 UTC


Message: Syntax error
Line: 197
Char: 9
Code: 0
URI: http://www.icucom.net:81/sites/all/modules/ddblock/js/ddblock.js?E

Thanks!
-=Delty

delty’s picture

Hoping you have the time to look at this soon please?

I just went through the troubleshooting and all looks good on my end from what I can tell.

Thanks,
-=Delty

delty’s picture

Title: White Block issue » Gery Block issue (SOLVED)
Component: Miscellaneous » Code
Category: support » bug
Status: Postponed (maintainer needs more info) » Fixed

Hi,

I got the grey block issue resolved, and this might help other folks as well. The JavaScript error above was the key!

I went in and took a look at line 197 in ddblock.js and found that there could be cases when the text being parsed wasn't JSON compliant. I changed the line as such:

From:

        var custom2 = JSON.parse(custom1);

To:

        var custom2 = JSON.parse(JSON.stringify(custom1));

This should ensure in the long term that any text being passed to the JSON method is compliant.

Thanks - really great mod with great support!

-=Delty

delty’s picture

Title: Gery Block issue (SOLVED) » Grey Block issue (SOLVED)
ppblaauw’s picture

Thanks for posting your solution, I had a look at the code and have the following comments.

Probably you use a wysiwyg editor with ads a <p></p> or a <br /> tag to the custom jquery field.

JSON.stringify of this value will return the string "<p></p>" which will be added to the option object as

0, <
1, p
2, >
4, <
5, /
6, p
7, >

This will prevent that a javascript error is thrown.

A better solution to prevent that html tags added by a wysiwyg editor are not used as JSON code is to test the custom string like:

if (custom !=null && typeof(custom)!="undefined" && custom.indexOf("{") == 0) {

custom should not be null
custom should not be undefined
custom should at least start with a { character

the JSON.stringify can would still be useful to convert e.g. ' to " for users who use ' instead " to make valid JSON code.

       var custom2 = JSON.parse(JSON.stringify(custom1));

Will add this custom value check to future version of the module.

delty’s picture

Thanks for the updated solution. I had gone back and added this field to the CKEditor ignore list, and then modified the field text to remove the paragraph tags, but that didn't seem to work, so making your code more "user proof" in this way is a good thing that will likely cut down on future issues of this sort.

Thanks again, great mod!

-=Delty

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.