First of all, thank you for this great module. Works awesome with standard blocks as well as blocks created by other modules such as Rotor.
However, I am having an issue getting block refresh to work with the Homebox module. Here is my test scenario:
1. Base install with the following modules:
- Homebox
- jquery UI
- block refresh
- PHP filter
2. Create a block with the following code:
<?php
echo rand(5, 15);
?>
3. Enabled manual and 1 second autorefresh for the new block.
4. Add block to content section of garland theme.
5. Watch the number refresh and randomly change every second.
So, that works great. Now, when I add a homebox page and the block to any column on the page, the block doesn't refresh nor does the manual refresh button show up. Can someone look at the following code from the homebox-block.tpl.php file and see if anything in there is suspect?:
<?php
// $Id: homebox-block.tpl.php,v 1.1.2.2 2009/05/26 14:18:32 jchatard Exp $
/**
* @file
* homebox-block.tpl.php
* Default theme implementation each homebox block.
*/
?>
<div id="homebox-block-<?php print $block->module .'-'. $block->delta; ?>" class="<?php print $block->homebox_classes ?> clear-block block block-<?php print $block->module ?>">
<div class="homebox-portlet-inner">
<h3 class="portlet-header"><?php print $block->subject ?></h3>
<div class="portlet-config">
<?php if (variable_get('homebox_users_use_colors_'. $pid, FALSE)): ?>
<div class="homebox-colors">
<?php for ($i=0; $i < HOMEBOX_NUMBER_OF_COLOURS; $i++): ?>
<span href="#" class="homebox-color-selector" style="background-color: <?php print variable_get('homebox_color_'. $pid .'_'. $i, '#E4F0F8') ?>;"> </span>
<?php endfor ?>
</div>
<?php endif ?>
<?php if ($block->module == 'views'): ?>
<?php $filters = theme('homebox_views_exposed_filter', $block) ?>
<?php print $filters ?>
<?php endif ?>
<?php if (variable_get('homebox_users_use_colors_'. $pid, FALSE) || $block->module == 'views' && !is_null($filters)): ?>
<div class="clear-block"></div>
<?php endif ?>
</div>
<div class="portlet-content"><?php print $block->content ?></div>
</div>
</div>
Also, here's the homebox.tpl.php code:
<?php
// $Id: homebox.tpl.php,v 1.1.2.1 2009/05/19 13:58:39 jchatard Exp $
/**
* @file
* homebox.tpl.php
* Default layout for homebox.
*/
?>
<div id="homebox" class="column-count-<?php print $column_count ?>">
<a href="#" id="homebox-add"><?php print t('Add content') ?></a>
<ul id="homebox-settings" class="homebox-settings-hidden">
<?php foreach ($available_blocks as $key => $block): ?>
<li>
<input type="checkbox" class="homebox_toggle_box" <?php print $block['checked'] ?> id="homebox_toggle_<?php print $block['dom_id'] ?>" /> <?php print $block['subject'] ?>
</li>
<?php endforeach ?>
</ul>
<?php for ($i = 1; $i <= count($regions); $i++): ?>
<div class="homebox-column" id="homebox-column-<?php print $i ?>">
<?php foreach ($regions[$i] as $key => $weight): ?>
<?php foreach ($weight as $block): ?>
<?php if ($block->content): ?>
<?php print theme('homebox_block', $block, $pid) ?>
<?php endif ?>
<?php endforeach ?>
<?php endforeach ?>
</div>
<?php endfor ?>
<div class="clear-block"></div>
</div>
<?php
// Print CSS classes based on colors
print $color_css_classes;
?>
<!-- End Homebox -->
My assumption is that the way homebox is displaying the block in the code. Can anyone assist, please?
Thank you!
Comments
Comment #1
jlslatton commentedAlso, here is some code from the block_refresh.module file that may be of interest in getting it to work:
I've tried changing to code to reflect the div ID that homebox uses:
The manual refresh button shows up now but doesn't work, nor does the autorefresh. Getting closer. Anyone with some actual code knowledge able to help me here?
Any help is greatly appreciated!
Comment #2
jlslatton commentedOk, so I got it working! Kinda. See the below code change:
As you can see, I added the correct css class that homebox was using for the div (homebox-block) and content (.portlet-content). The manual refresh works as well as the autorefresh!
Well, of course, now it doesn't work for any blocks outside of homebox. While this isn't a huge deal for me currently, I can see a need for a refresh of a block outside of homebox at some point in the near future.
Can someone change the code logic above to check for "homebox-block" and ".portlet-content" (or any variant thereof) as well as the default? I could change it on the homebox end but it seems like it would be easier to get block_refresh to look for both.
Again, any help is greatly appreciated!
Comment #3
velosol commentedTotal shot in the dark here, and it may break other things, but...
You could try adding the original '$div' line back in as, say, $div_two and write an additional callback a la:
And then similarly for the manual refresh portion (although I think you might end up with two buttons, only one of which works). This may also cause a bunch of calls to hit your server and generate errors because the requested div doesn't exist. But I'd encourage you to give it a try!
Comment #4
bocaj commentedMarking as "won't fix" since there has been no activity on this forum in quite some time.
Comment #5
ah0 commentedI understand this thread was ended long ao but the issue is still out there...
I just tried doing the above ( #2 ) but didn't seem to work for me;
Ps. I'm using the Block Refresh 6.x-1.x-dev.
could please provide any pointers as what could be the case?
below is my edited block_refresh.module :