Hi,

I've searched through the forum, and for some reason didn't find an answer to my question. I have a text that includes the tags <i>something</i>; this information is contained in a CCK text field (CCK 6.x-1.0-alpha), and when I added this information the "full HTML" filter was selected. When the Content Template with either:

    <?php print check_plain($node->field_causas[0]['value']) ?>
      or
        <?php print check_plain($node->field_causes[0]['view']) ?>

        The output just prints the text with the HTML tags and does not evaluate them, without printing the text in italic. Then, I changed the code to:

          <?php print check_markup($node->field_causas[0]['value']) ?>
            or
              <?php print check_markup($node->field_causes[0]['view']) ?>

              And now the HTML tags are not printed, but aren't evaluated either

              Thanks in advance

Comments

jrglasgow’s picture

One of your problems is you are using the <i> italics tag. The "Filtered HTML" that is default with Drupal installations will not use the <i> tag. Instead use the <em> Emphasis tag. If you will notice the <em> tag is included as one of those allowed in these comments(look below the comment field).

You are calling check_markup() and not giving it a format, thus check_markup() uses the default "Filtered HTML" which disallows the <i> tag.

The use of check_plain() is also causing a problem. check_plain(), according to the definition, is there to:

Encode special characters in a plain-text string for display as HTML.

This means that the tags that would normally cause something to display as HTML will be specially encoded so they are only displayed and not actually used as tags, because this could lead to Cross Site Scripting.

Your best bet would be to either use check_markup() with <em>something</em> instead of <i>something</i>, or use check_markup with the "Full HTML" filter like this

      <?php print check_markup($node->field_causes[0]['view'], 2) ?>

by default the filter format #2 is "Full HTML"

faunapolis’s picture

Status: Active » Closed (fixed)

Got it, thank you very much. I thought contentplate would take the filter format selected when entering the node. I understand that you have control of that in the actual template with the number at the end of the print command.

glass.dimly’s picture

Version: 6.x-0.13 » 5.x-2.02
Status: Closed (fixed) » Active

Hello,

jrglasgow: This was a well-considered response to a question. Also, Contemplate is awesome. Thanks, Drupal is better for it.

So.... I have another question. I have the same problem, that html tags are being printed. I tried this;

<?php print check_markup($node->field_bibliographic_citation_if[0]['view'], 2) ?>

I am using and admin account where the role "admin" has access to the filter "Full HTML". I've also tried my default filter "Rich Text", which, from the database, I know to be #4, and is correctly displaying the body field just above which includes markup.

Thanks much,
jmjohn

glass.dimly’s picture

OK,

I can answer my own question. I changed the CCK Field type from taking "Plain Text" to "Filtered Input".

Because it was a Plain Text field that was greater than 2 rows, FCKeditor was invoked, which resulted in HTML output, while the field type was set to plain text.

So, apparently, if a field is Plain Text, you can't run check_markup() on it. Weird. Is this really true, or should I file some sort of bug somewhere? Advice?

Feel free to mark this closed if you don't have any advice.

-jmjohn

jrglasgow’s picture

Status: Active » Closed (fixed)

I really can't say that I have any advice, FCKeditor just takes an text area and creates the HTML. I guess you could post a bug report with FCKeditor, I don't know, though, how they would check the CCK field type.