Create a new custom ddblock theme

Your Ad Here

How to create your own custom dynamic display block theme

This page gives a detailed step by step instruction on how to create your own custom dynamic display block theme.

This example assumes that you want to make a new theme: custom40-a using the existing theme upright40.

  1. Go to directory: sites/all/[YOUR_THEME_NAME]/custom/modules/ddblock
  2. Create a copy of ddblock-cycle-block-content-upright40.tpl.php and save as ddblock-cycle-block-content-custom40-a.tpl.php.
  3. Edit ddblock-cycle-block-content-custom40-a.tpl.php
  4. Replace all occurrences of upright40 with custom40-a.
  5. Replace all occurrences of $template with $custom_template
    1. From the code:
        drupal_add_css($directory .'/custom/modules/ddblock/'.$template. '/ddblock-cycle-'.$template. '.css', 'template', 'all', FALSE); 

      Change to:

      drupal_add_css($directory .'/custom/modules/ddblock/'.$custom_template. '/ddblock-cycle-'.$custom_template. '.css', 'template', 'all', FALSE);

    2. From the code:
      <div id="ddblock-<?php print $delta ?>" class="ddblock-cycle-<?php print $template ?> clear-block">

      Change to:

      <div id="ddblock-<?php print $delta ?>" class="ddblock-cycle-<?php print $custom_template ?> clear-block">

  6. Create a copy of ddblock-cycle-pager-content-upright40.tpl.php and save as ddblock-cycle-pager-content-custom40-a.tpl.php.
  7. Edit ddblock-cycle-pager-content-custom40-a.tpl.php
  8. Replace all occurrences of upright40 to custom40-a.
  9. Create a copy of the upright40 directory and save as custom40-a.
  10. Goto the custom40-a directory
  11. Rename ddblock-cycle-upright40.css to ddblock-cycle-custom40-a.css.
  12. Edit ddblock-cycle-custom40-a.css
  13. Replace all occurrences of upright40 with custom40-a.
  14. You can now edit the template files and the css file to get your desired advanced dynamic display block layout.

Comments

Drupal 7?

Is there an equivalent for Drupal 7x? Or should these instructions be the same? :)

Can't get cycleblock to display

I have been banging my head on setting up an advanced slideshow for far too long.

I am 99.9% sure I followed your tutorial to the T, but I can't get the slideshow to display once I set it to "Cycleblock"
It will display as "Default," but not with the pretty formatting of my chosen theme.
I've tried different themes, and that doesn't make a difference.

When I delete my view, suddenly the images I had uploaded into my news_items display on my page, until I go and edit my blocks. I've tried making a new view and displaying the block again, and it goes back to showing me nothing.

My site is here: http://www.spokanebuddhisttemple.org/dev

Can you help? I'm beyond stumped.

Re: Can't get cycleblock to display

Please make an issue in the issue queue of the module

Thanks for such nice and detailed tutorial.

I am very grateful to the author of this nice tutorial. The best part of the tutorial is that it does not leave any chance for a newbee to make a mistake or to mis-understand an issue. I created an advanced dynamic display from this tutorial.
Note: If someone is follwing the tutorial and still does not get the desired result. Then make sure to empty cache as the last step. I had this problem. Even after placing the preprocess functions in template.php file, there were no images displaying in the block, but only heading of the block. Then i emptied the cache and the block was successfully working.
Thanks again for this nice tutorial.

I can't see any image after following the above steps

Hello ppblauuw,

Sincerely nice work. However, I have followed the steps described above but after changing the theme to custom in the block configuration, I can't seem to see any image get displayed. I don't know where i'm missing it.

My question is apart from changing $template to $custom_template in the custom template, is there any variable that needs to be modified? What about the template override in the template.php file, should the override be removed? i don't know. I just need help.

Thanks.

Nevermind I got a solution.

Nevermind I got a solution. Nice work.

Error on creating custom template files

I copied the template files as per the instructions above except that I used connect2mason as the name.
My directory structure is:
sh-3.2$ ls *
ddblock-cycle-block-content-connect2mason.tpl.php ddblock-cycle-pager-content-connect2mason.tpl.php NOTES.txt
ddblock-cycle-block-content-upright40.tpl.php ddblock-cycle-pager-content-upright40.tpl.php

connect2mason:
ddblock-cycle-connect2mason.css

images:
readmore-hover.png readmore.png transparent_bg.png

TMP:
ddblock-cycle-block-content.tpl.php ddblock-cycle-block-content-upright30.tpl.php ddblock-cycle-pager-content-upright10.tpl.php ddblock-cycle-pager-content-upright50.tpl.php upright30
ddblock-cycle-block-content-upright10.tpl.php ddblock-cycle-block-content-upright50.tpl.php ddblock-cycle-pager-content-upright20.tpl.php upright10 upright50
ddblock-cycle-block-content-upright20.tpl.php ddblock-cycle-pager-content.tpl.php ddblock-cycle-pager-content-upright30.tpl.php upright20

upright40:
ddblock-cycle-upright40.css

The error I receive is
The block configuration has been saved.
warning: include(./sites/all/themes/tao/custom/modules/ddblock/ddblock-cycle-pager-content.tpl.php) [function.include]: failed to open stream: No such file or directory in /home/drupal/public_html/includes/theme.inc on line 1020.
warning: include() [function.include]: Failed opening './sites/all/themes/tao/custom/modules/ddblock/ddblock-cycle-pager-content.tpl.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /home/drupal/public_html/includes/theme.inc on line 1020.
warning: include(./sites/all/themes/tao/custom/modules/ddblock/ddblock-cycle-block-content.tpl.php) [function.include]: failed to open stream: No such file or directory in /home/drupal/public_html/includes/theme.inc on line 1020.
warning: include() [function.include]: Failed opening './sites/all/themes/tao/custom/modules/ddblock/ddblock-cycle-block-content.tpl.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /home/drupal/public_html/includes/theme.inc on line 1020.

Re: Error on creating custom template files

The error says that it can not find the files

ddblock-cycle-block-content.tpl.php
ddblock-cycle-pager-content.tpl.php

You need to have:

ddblock-cycle-block-content.tpl.php
ddblock-cycle-pager-content.tpl.php

in the directory
/sites/all/themes/tao/custom/modules/ddblock/

Otherwise files like:
ddblock-cycle-block-content-connect2mason.tpl.php 
ddblock-cycle-pager-content-connect2mason.tpl.php

can not be used.

Same as you need:

node.tpl.php

in the same directory of your theme when you want to use template files per node content_type like
node-[my content type].tpl.php

Hope this helps you further, please let me know.

warning: Invalid argument

warning: Invalid argument supplied for foreach() in F:\wamp\www\netcare\sites\all\themes\xinonetworks\custom\modules\ddblock\ddblock-cycle-block-content-upright10.tpl.php on line 47.
why?
thank you!

Re: warning Invalid argument

Have a look at the faq question warning: Invalid argument supplied for foreach() in... solution?

Hope this helps you further, please let me know.

If not please make an issue in the issue queue of the module.

Additional themes

I got the upright package working and now I would like to add your additional weekly themes. I have tried copying these into the formers' folder estructure, so that they will coexist. But this method replaces some files from upright and doesn't seem to work. How can I have the new themes available without deleting others?
Thank you so much,

How to change location

How do you change the path to the theme?

I would like to have the path be: [MY-THEME]/ddblock/
instead of: [MY-THEME]/custom/modules/ddblock/[TEMPLATE]/

Re: How to change location

Move the ddblock directory from:
[MY-THEME]/custom/modules/
to
[MY-THEME]/

delete the custom directory including the subdirectory modules

Clear the cache at Administer > Site configuration > Performance

Hope this helps you further, please let me know.

worked

That works, thanks for the help.