You are here

README.txt in Web Widgets 6

Same filename and directory in other branches
  1. 7 README.txt
Web Widgets
===========

"Copy/paste widgets for your Drupal site. Plays nice with Views."

Description
===========

Use Web Widgets to build dynamic snippets of your website that users can copy 
and paste to their websites.

Installation and Usage
======================

Web widgets can be used by any other module to generate copy/paste widgets. 
However, the most common use case is to use it together with Views module.

Here is how to use Web Widgets with Views: 

* Install Views http://drupal.org/project/views.
* Install Web Widgets.
* Create a new view, add and configure a Page display, add and configure a 
  Widget display.
* Attach the widget to the page display. When you go to the page, you should 
  see a textfield with code that can be embedded on other websites.
  
API Usage
=========

The API functions are:
web_widgets_render_embed_code($style, $path, $width, $height);
web_widgets_render_widget($style, $content, $title, $add_target = TRUE);

$style can be google_gadgets, iframe, inline or uwa

1) Get the code what you can paste into the external site, for example:

$embed_code = web_widgets_render_embed_code('inline', 'mywidget', 100, 500);

2) In hook_menu(), define the path that you exposed in the widget embedding code, for example:

$['mywidget'] = array(
  '#page callback' => 'widgetfunc',
  '#access arguments' => array('access content'),
);

3) Generates the content inside the widget, for example:

function widgetfunc() {
  $title = 'example widget';
  $content = 'widget body';
  return web_widgets_render_widget('inline', $content, $title);
}

File

README.txt
View source
  1. Web Widgets
  2. ===========
  3. "Copy/paste widgets for your Drupal site. Plays nice with Views."
  4. Description
  5. ===========
  6. Use Web Widgets to build dynamic snippets of your website that users can copy
  7. and paste to their websites.
  8. Installation and Usage
  9. ======================
  10. Web widgets can be used by any other module to generate copy/paste widgets.
  11. However, the most common use case is to use it together with Views module.
  12. Here is how to use Web Widgets with Views:
  13. * Install Views http://drupal.org/project/views.
  14. * Install Web Widgets.
  15. * Create a new view, add and configure a Page display, add and configure a
  16. Widget display.
  17. * Attach the widget to the page display. When you go to the page, you should
  18. see a textfield with code that can be embedded on other websites.
  19. API Usage
  20. =========
  21. The API functions are:
  22. web_widgets_render_embed_code($style, $path, $width, $height);
  23. web_widgets_render_widget($style, $content, $title, $add_target = TRUE);
  24. $style can be google_gadgets, iframe, inline or uwa
  25. 1) Get the code what you can paste into the external site, for example:
  26. $embed_code = web_widgets_render_embed_code('inline', 'mywidget', 100, 500);
  27. 2) In hook_menu(), define the path that you exposed in the widget embedding code, for example:
  28. $['mywidget'] = array(
  29. '#page callback' => 'widgetfunc',
  30. '#access arguments' => array('access content'),
  31. );
  32. 3) Generates the content inside the widget, for example:
  33. function widgetfunc() {
  34. $title = 'example widget';
  35. $content = 'widget body';
  36. return web_widgets_render_widget('inline', $content, $title);
  37. }