开发者

How to create Wordpress-style widgets in Drupal

I'm investigating which CMS to use for my next project and am currently looking at Drupal. What I will need to do for the project is create widgets kind of like in Wordpress. Basically, little boxes that the user can provide parameters for, and I use the parameters in the widget. They can then place the widgets on the page, just like blocks. For instance I would like to have a "Double image box" widget. The user would provide text, 2 image urls and a title. The widget would draw the box and wrap the images and text appropriately with divs and styles.

What would the best way to do thi开发者_开发百科s in Drupal be?


Drupal calls these blocks. They work essentially the same way. You create them by having a module hook into hook_block.


For that specific case, I'd suggest creating a new content type using CCK (to give yourself custom fields). The user can use that to add/edit the stuff that goes into the sidebar block.

Then you can use Views to make that content type into a block that you can put into your sidebar block region.

Don't scare this guy off by telling him to create a custom module right off the bat for something that doesn't need it.


i think what you could do best is use the features module. features can carry their own content-types, views, etc. but they are also modules, so you can add your own code, js and css. that way every 'widget' users may want to add can be available through the features interface, and it is kinda easy to deploy. try it out drupal.org/project/features


There are lots of modules ready to be used. For some widgets you want to provide it might be possible that a drupal module is already written, so you just need to add it to your installation. I can think of this kind of functionalities right now: the AddThis module. Here is an excerpt from its project page:

AddThis is the #1 bookmarking and sharing button on the Internet. AddThis has become the standard button for bookmarking and sharing. The AddThis button spreads your content across the Web by making it easier for your visitors to bookmark and share it with other people, again…and again…and again. This simple yet powerful button is very easy to install and provides valuable Analytics about the bookmarking and sharing activity of your users. AddThis helps your visitors create a buzz for your site and increase its popularity and ranking. (source: addthis.com)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜