community.egroupware.org: Community wiki

  
Community wiki
htmlarea

htmlarea()

You can use the htmlarea function form the api to create WYSIWYG-htmleditors in your application. This can be very usefull.

As the htmlarea is an application of its own you must know a few think before you can make use of all its features.

You can print a htmlarea in your app like the example below

<code>
$style='width:500px; min-width:500px; height:400px;';
$contents='<strong>Hello world!</strong>';
$plugins = 'ContextMenu,TableOperations,SpellChecker,UploadImage';

/* the lay-out you see below is the default lay-out. You can change this lay-out be changing the javascript-array*/
$custom_toolbar = '[
[ "fontname", "space",
"fontsize", "space",
"formatblock", "space",
"bold", "italic", "underline", "separator",
"strikethrough", "subscript", "superscript", "separator",
"copy", "cut", "paste", "space", "undo", "redo" ],

[ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
"orderedlist", "unorderedlist", "outdent", "indent", "separator",
"forecolor", "hilitecolor", "textindicator", "separator",
"inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode", "separator",
"popupeditor", "separator", "showhelp", "about" ]
];';

$GLOBALS['phpgw']->html->htmlarea('i_am_a_htmlarea',$contents ,$style,false,$plugins,$custom_toolbar);
</code>

Below some explanations of the arguments.
  1. $name string name and id of the input-field
  2. $content string of the htmlarea (will be run through htmlspecialchars !!!), default ''
  3. $style string inline styles, eg. dimension of textarea element
  4. $base_href string set a base href to get relative image-pathes working
  5. $plugins string plugins to load seperated by comma's, eg 'TableOperations?,ContextMenu?' (htmlarea breaks when a plugin #calls a nonexisiting lang file)
  6. $custom_toolbar when given this toolbar lay-out replaces the default lay-out.

using the plugins

Some plugins are quite simple, you can just include them. Some plugins need extra attention before they will work like the UploadPlugin?. You can find README's in the plugindirectories e.g.: phpgwapi/js/htmlarea/plugins/UploadImage/README.

You are here