CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • CKEditor, Views, HTML tags showing in output [Workaround Found]
Pages: [1]

Author Topic: CKEditor, Views, HTML tags showing in output [Workaround Found]  (Read 3401 times)

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
CKEditor, Views, HTML tags showing in output [Workaround Found]
July 02, 2012, 09:28:04 pm
I'm having a problem with a custom field showing HTML tags with the content.

I've configured WYSIWYG, set the display preferences to Drupal Default Editor, created a custom field for a profile (set as Standalone Form or Directory only), turned on the Smarty filter on the text format, and inserted the custom field in a Drupal-view.

The Drupal-view has a link to edit the profile (/civicrm/profile/edit?reset=1&id=5932&gid=13), the edit page includes the proper text editor, but when the save button is submitted the text editor changes from a Filtered HTML box to a Text box and the user is directed to the Civi-view page (/civicrm/profile/view?reset=1&id=5932&gid=13). The output is correct in the Civi-View, but I can't figure out why the output in the Drupal-view shows the HTML tags.

This page http://wiki.civicrm.org/confluence/display/CRMDOC41/Configuring+CiviCRM+to+Use+the+Default+Drupal+Editor makes it seem that Drupal and Civi should work together.

Is this a problem with CKEditor, WYSIWYG, Views, or CiviCRM?



Here's a way to modify the Civi HTML output back to the correct characters for a Drupal view.

I'm using a template form just to change one field in the view; other templates can be created to modify the whole view.

1) Find the template file: sites/all/modules/views/theme/views-view-field.tpl.php

2) Copy the file to your theme folder

3) Rename the file to views-view-field--your-view-name--your-field-name.tpl.php

4) Edit the file to include the following:
<?php
$output=str_replace('&lt;/', '</', $output);
?>
<?php
$output=str_replace('&lt;', '<', $output);
?>
<?php
$output=str_replace('/&gt;', '/>', $output);
?>
<?php
$output=str_replace('&gt;', '>', $output);
?>
<?php
$output=str_replace('&nbsp;', ' ', $output);
?>
<?php
$output=str_replace('&quot;', '"', $output);
?>
<?php
$output=str_replace('&amp;', '&', $output);
?>
<?php print $output; ?>


5) Save the file, clean cache or theme registry

Your view should now recognize the new theme template and output the expected results.
« Last Edit: July 04, 2012, 04:44:34 pm by joemaine »
--
Joe

questions

  • I post occasionally
  • **
  • Posts: 79
  • Karma: 2
  • CiviCRM version: 4.4.6
  • CMS version: Durpal, 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: CKEditor, Views, HTML tags showing in output [Workaround Found]
September 19, 2012, 08:11:24 pm
I'm having the same problem but with inserting custom fields into email.  It took me a long time to figure out that the quotes, nbsp's, etc. were not be seen by the smarty stuff as they should.

I'm having to do all the work in CKEditor and then switch it to TinyMCE and save the email again before I send a test or the final email.  (TinyMCE is limited in options and only occasionally will it show the raw html)

I see your work around which makes sense, but I haven't a clue how to implement it or if it is even possible for email with smartys.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • CKEditor, Views, HTML tags showing in output [Workaround Found]

This forum was archived on 2017-11-26.