Hi all
I added a WYSIWYG editor in a custom page to amend the product descriptions (products_description.products_description) more easily. It also lets me add color and change text size. Hope it's of some use
Download the WYSIWYG editor from openwebware.com
and make a donation to say thanks to the guy that wrote this (not me, honest)
Upload the files to your includes/js/ directory into a new folder. eg openwysiwyg_v147 as below
Add these lines to your custom page tpl_mypage_DEFAULT.php after the require ($define_page);
<!--INCLUDES FOR WYSIWYG EDITOR-->
<script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg-popup.js"></script>
<script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg-color.js"></script>
<script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg.js"></script>
<script language="JavaScript" type="text/javascript" src="includes/js/openwysiwyg_v147/scripts/wysiwyg-settings.js"></script>
Immediately after you create the form eg
echo zen_draw_form('productsEditForm', zen_href_link(FILENAME_PRODUCTS_EDIT, '','SSL'),'POST'); ?>
add
<script language="javascript1.2">
// attach the editor to the textarea with a matching identifier'.
WYSIWYG.attach('products_description');
</script>
Now create a textarea. Note that the id of the textarea must match the above WYSIWYG.attach call
<textarea rows="15" name="products_description" id="products_description">db_text</textarea>
Click when finished <input type="submit" name='submit' value="Done">
and close the form...
</form>
The form handler takes the contents, in my example, from $_POST['products_description].
Hope that's all clear and correct. If you want to pre-populate the textarea with your products_description insert the query result where I've written db_text.
The editor has a few non-funky features such as opening new windows to handle text color and it flags a couple of deprecated command errors in firebug. If anyone wants to provide feedback on how these can be tidied up I'd be grateful as the openwebware page doesn't seem to have a forum to discuss this. Similarly with any security issues the code might raise. Credit should go to the openwebware guy for the editor code, I've only shoehorned it into zencart.
Steve




