News Feed E-mail

Get How-To's right in your inbox. Subscribe to the HowToJoomla! news feed e-mail. Just enter your email address here:

Delivered by FeedBurner

Login






Lost Password?
No account yet? Register

Affiliates

Azrul's JomComment
JoomlaShack
iJoomla
The Joomla! Store
Member of W3C Sites dot com
How to add a widget to a module PDF Print E-mail
Written by Cory   
Thursday, 15 March 2007

Wikipedia defines a widget like this:

A web widget is a portable chunk of code that can be installed and executed within any separate HTML-based web page by an end user without requiring additional compilation. They are akin to plugins or extensions in desktop applications. Other terms used to describe a Web Widget include Gadget, Badge, Module, Capsule, Snippet, Mini and Flake. Web Widgets often but not always use Adobe Flash or JavaScript programming languages.

For example, the "Help Azaria" module in the left column of this site uses a widget from ChipIn.com (to test it, make a donation to Azaria's Dolphin Therapy fund to see the progress bar go up - wink wink). Many "web 2.0" sites offer widgets for blogs and other sites to display their content or tools for performing a specific task (like raising money via the ChipIn widget). It is a great way to add content or functionality to your site with very little effort. The process for embedding a widget to your site is usually just copying and pasting a snippet of code into the appropriate location.

The problem is, Joomla!'s built-in WYSIWYG editors strip out parts of the widget's code causing it to work improperly. With this article, I will explain how to work around that problem and get the widget embedded into a user module without stripping out code.

Step 1: Disable your WYSIWYG editor.

There are two ways to disable your WYSIWYG editor: the global configuration and the user manager.

Global Configuration

To disable the WYSIWYG editor in the global configuration, follow these steps:

  1. Log in to your administrator control panel.
  2. Click Site -> Global Configuration.
  3. In the first tab, set "Default WYSIWYG Editor:" to "No WYSIWYG Editor".
  4. Click "Save".

The problem with disabling the WYSIWYG editor in the global configuration is that it affects all users. You may want to keep the editor enabled for other users and disable it for yourself. If that is the case, you should disable the WYSIWYG editor in the user manager.

User Manager

To disable the WYSIWYG editor in the user manager, follow these steps:

  1. Log in to your administrator control panel.
  2. Click Site -> User Manager.
  3. Click the Name of the user you want to modify.
  4. In the right column under "parameters", set "User Editor" to "No WYSIWYG Editor".
  5. Click "Save".

Step 2: Create the module.

To create the module, follow these steps:

  1. Log in to your administrator control panel.
  2. Click Modules -> Site Modules.
  3. Click "New".
  4. Enter the details, parameters, and pages/items to suit your needs.
  5. Copy your widget code from your widget provider.
  6. Paste the widget code into the content box under "Custom Output".
  7. Click "Save".

NOTE: You can add more content to the content box, but you will have to use HTML because your WYSIWYG editor is disabled.

You are now widgetized.

That's all there is to it. You now have a widget. I should caution you, though, that too many widgets make a page look cluttered and unprofessional. So, choose wisely. Only use the widgets you actually need to use.

Other options

There are mambots/plugins and modules available that enable you to paste code into your WYSIWYG editor without it stripping out parts of the code. One example of such a module is the Jumi module and plign. If you can think of any more, please feel free to list it in the comments.

Questions

If you have any questions or comments, as always feel free to add them to the comments below.

Trackback(0)
Comments (4)add comment
I used to do that, but lately I've been using Fiji Web Design's Google Adsense Module. The name is misleading as it's actually a module that lets you add any html or javascript code. It's simply brilliant! http://fijiwebdesign.com//content/view/74/54/

Cheers,
Nez
www.gooeytechnology.com
1

report abuse
vote down
vote up
March 29, 2007
Votes: +1
Thanks for the tip, Nez.
2

report abuse
vote down
vote up
March 29, 2007
Votes: +0
Thanks for taking the time to provide this tip, well written, easy to follow, thank you! smilies/grin.gif
3

report abuse
vote down
vote up
October 19, 2007
Votes: +0
Tiff: ...
Ok, sounds good. But can I turn the WYSIWYG editor back on and do other things or will it strip the code again.
4

report abuse
vote down
vote up
February 09, 2008
Votes: +0

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

busy
 
Tag it:
Delicious
Digg
Technorati
< Prev   Next >
Phil-A-Form

About HowToJoomla

HowToJoomla was started in September 2006 by me, Cory Webb, a long-time Mambo/Joomla user with a desire to give back to the community that has given so much to him.

HowToJoomla is not the best, most comprehensive Joomla tips site out there. That's not the goal. The goal is to share some of the knowledge and experience that I have gained through years of using the world's best content managment system. I hope that you will find this site useful and visit often. As I come across new tips and ideas, I will post them here for all to see.

I hope you enjoy using HowToJoomla and find it very useful.

Please take some time to read the Disclaimer.

Thanks for visiting!

About Me

I am a 28-year-old husband and father of a beautiful baby girl named Lucy. I have a degree in Electrical Engineering from the University of Texas at Austin, an MBA from Baylor University, and over 4 years experience working with the Mambo/Joomla CMS.

On February 1, 2008, I started a web design, development, and consulting company specializing in designing and developing custom Joomla-powered websites. The new company is aptly named Cory Webb Media, LLC. The double meaning is purely unintentional, but with a last name like "Webb" it is difficult to escape the obvious puns. If you are looking for professional assistance with your website, please feel free to contact me to discuss your project.

I also run HowToJoomla, CoryWebb.com (my personal website/blog), and JoomlaForm.com (a site dedicated to promoting good design in the Joomla! community). In my spare time (if there is such a thing), I volunteer with the youth ministry at my church.

Copyright © 2006 - Cory Webb Media, LLC - All rights reserved.
Powered by Joomla!